61 lines
1.2 KiB
Fish
61 lines
1.2 KiB
Fish
|
#!/usr/bin/fish
|
||
|
|
||
|
set img_idx 0
|
||
|
set is_quiet true
|
||
|
set root_dir "."
|
||
|
|
||
|
function build_image
|
||
|
# First argument: (optional) remove parent image? (true or false)
|
||
|
# Second argument: file name to build
|
||
|
|
||
|
# Parse arguments
|
||
|
if test (count $argv) -eq 2
|
||
|
set remove_previous $argv[1]
|
||
|
set build_file $argv[2]
|
||
|
else if test (count $argv) -eq 1
|
||
|
set remove_previous true
|
||
|
set build_file $argv[1]
|
||
|
end
|
||
|
|
||
|
printf "Building $build_file...\n"
|
||
|
|
||
|
docker build $root_dir \
|
||
|
--quiet=$is_quiet \
|
||
|
--build-arg BASE_CONTAINER=betalupi/jupyter-inter-$img_idx \
|
||
|
-f $build_file.Dockerfile \
|
||
|
-t betalupi/jupyter-inter-(math $img_idx + 1)
|
||
|
|
||
|
|
||
|
if $remove_previous
|
||
|
printf "Done, cleaning up.\n\n"
|
||
|
sleep 1
|
||
|
docker image rm betalupi/jupyter-inter-$img_idx
|
||
|
else
|
||
|
printf "Done. \n\n"
|
||
|
end
|
||
|
|
||
|
set img_idx (math $img_idx + 1)
|
||
|
end
|
||
|
|
||
|
|
||
|
|
||
|
# Base image MUST be built first
|
||
|
printf "Building base image...\n"
|
||
|
docker $root_dir/build \
|
||
|
--quiet=$is_quiet \
|
||
|
-t betalupi/jupyter-inter-0
|
||
|
printf "Done. \n\n"
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
build_image false octave
|
||
|
build_image false r
|
||
|
build_image false sage
|
||
|
|
||
|
build_image false plugins
|
||
|
build_image pymodules
|
||
|
|
||
|
# Rename final image
|
||
|
docker image tag betalupi/jupyter-inter-(math $img_idx) betalupi/jupyter
|
||
|
docker image rm betalupi/jupyter-inter-(math $img_idx)
|