Added check for existing Ubuntu base image

This commit is contained in:
njalooo 2023-06-06 20:38:27 +02:00 committed by GitHub
parent 88112c3a99
commit 157b3a0733

View file

@ -3,11 +3,21 @@
PURPLEBOLD="$(tput setf 5 bold)" PURPLEBOLD="$(tput setf 5 bold)"
#Checks if image ubuntu already exists:
IMAGEEXISTS=true
if [[ "$(docker image inspect ubuntu >/dev/null 2>&1 && echo true || echo false)" = "false" ]]; then
IMAGEEXISTS=false
fi
printf "${PURPLEBOLD}Building temporary modified Ubuntu image:\n" printf "${PURPLEBOLD}Building temporary modified Ubuntu image:\n"
docker build -t lancachenet/ubuntu:latest --progress tty https://github.com/lancachenet/ubuntu.git docker build -t lancachenet/ubuntu:latest --progress tty https://github.com/lancachenet/ubuntu.git
#Removes standart Ubuntu image if not present before running:
if [$IMAGEEXISTS" == false]; then
printf "${PURPLEBOLD}Removing standart Ubuntu image:\n" printf "${PURPLEBOLD}Removing standart Ubuntu image:\n"
docker rmi ubuntu docker rmi ubuntu
fi
printf "${PURPLEBOLD}Building temporary Ubuntu-Nginx image:\n" printf "${PURPLEBOLD}Building temporary Ubuntu-Nginx image:\n"
docker build -t lancachenet/ubuntu-nginx:latest --progress tty https://github.com/lancachenet/ubuntu-nginx.git docker build -t lancachenet/ubuntu-nginx:latest --progress tty https://github.com/lancachenet/ubuntu-nginx.git