Added docker_build
This commit is contained in:
parent
ff57016f0c
commit
ea8985ade5
66
docker_build
Executable file
66
docker_build
Executable file
@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
|
||||
repeat_char(){
|
||||
end="$1"
|
||||
for _ in $(seq 1 "$end") ; do
|
||||
printf '%s' "$2";
|
||||
done
|
||||
}
|
||||
|
||||
header(){
|
||||
env printf "┌$(repeat_char 40 ─)┐\n"
|
||||
env printf '│ %-38s │\n' "$1"
|
||||
env printf "└$(repeat_char 40 '─')┘\n"
|
||||
}
|
||||
|
||||
base_images_cache=''
|
||||
|
||||
pull_base_images(){
|
||||
base_images=$(echo "$1" | sed 's/ /\n/g' | rg -v "^($(printf '%s' "$base_images_cache" | sed -s 's/ /\|/g'))$" | paste -sd ' ')
|
||||
# echo "BASE: $base_images"
|
||||
# echo "CACHE: $base_images_cache"
|
||||
if [ -n "$base_images" ]; then
|
||||
base_images_cache="$base_images_cache $base_images"
|
||||
echo 'Downloading base images'
|
||||
echo "$base_images" | xargs -n1 docker pull
|
||||
fi
|
||||
}
|
||||
|
||||
build(){
|
||||
[ ! -d "$1" ] && return 0
|
||||
header "$(basename "$1")"
|
||||
pull_base_images "$(fd Dockerfile "$1" -x rg FROM | cut -d ' ' -f 2 | sort | uniq | paste -sd ' ')"
|
||||
echo 'Building...'
|
||||
if [ -z "$2" ]; then
|
||||
(cd "$1" && docker compose pull)
|
||||
(cd "$1" && docker compose build)
|
||||
else
|
||||
(cd "$1" && docker compose build "$2")
|
||||
fi
|
||||
}
|
||||
|
||||
if ! rc-service docker status > /dev/null; then
|
||||
echo 'Docker is not started, exiting'
|
||||
return 1
|
||||
fi
|
||||
|
||||
build /home/_aspil0w/git/3d-playground
|
||||
build /home/_aspil0w/git/CoverLetter
|
||||
build /home/_aspil0w/git/CurriculumVitae
|
||||
build /home/_aspil0w/git/dotfiles
|
||||
build /home/_aspil0w/git/ESP32Manager
|
||||
build /home/_aspil0w/git/haskell_playground
|
||||
build /home/_aspil0w/git/IntershipReport
|
||||
build /home/_aspil0w/git/notebook
|
||||
build /home/_aspil0w/git/workspace/personnal_projects/ollama-webui
|
||||
build /home/_aspil0w/git/portfolio no_ssl
|
||||
build /home/_aspil0w/git/portfolio_ivo no-ssl
|
||||
build /home/_aspil0w/git/SimpleGradientDescent
|
||||
build /home/_aspil0w/git/sorting_algorithms
|
||||
build /home/_aspil0w/git/VariationalAutoEncoder
|
||||
build /home/_aspil0w/git/ViolaJones
|
||||
build /home/_aspil0w/git/wgan-gp
|
||||
build /home/_aspil0w/git/WGAN-GP_Pytorch
|
||||
build /home/_aspil0w/git/workspace/Data\ analysis/Speed\ dating\ experiment
|
||||
build /home/_aspil0w/git/workspace/Miage/M2/Implementation\ de\ l\'IA
|
||||
build /usr/local/src/Ventoy
|
Loading…
x
Reference in New Issue
Block a user