Skip to content
Snippets Groups Projects
Commit 0136691a authored by jurgenhaas's avatar jurgenhaas
Browse files

#5 Update existing container if image got updated

parent b4262432
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ if [[ "$1" == "help" ]]; then ...@@ -4,7 +4,7 @@ if [[ "$1" == "help" ]]; then
echo "L3D - LakeDropsDrupalDev" echo "L3D - LakeDropsDrupalDev"
echo "=========================" echo "========================="
echo "" echo ""
echo "Version: 1.1.0" echo "Version: 1.2.0"
echo "Info and support: https://gitlab.lakedrops.com/docker/l3d" echo "Info and support: https://gitlab.lakedrops.com/docker/l3d"
exit 0 exit 0
fi fi
...@@ -45,11 +45,24 @@ if [[ "${COMPOSE_PROJECT_NAME}" == "" ]]; then ...@@ -45,11 +45,24 @@ if [[ "${COMPOSE_PROJECT_NAME}" == "" ]]; then
echo "COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME}" >>.env echo "COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME}" >>.env
fi fi
ID=$(docker container ls -q -f name=${COMPOSE_PROJECT_NAME}_l3d)
if [[ "$1" == "update" ]]; then if [[ "$1" == "update" ]]; then
docker pull registry.lakedrops.com/docker/l3d:php-${PHP_VERSION} echo "Updating the image ..."
STATUS=$(docker pull registry.lakedrops.com/docker/l3d:php-${PHP_VERSION})
if [[ "$STATUS" == *"Status: Image is up to date"* ]]; then
echo "Already up to date"
else
echo "Image updated"
if [[ -n "$ID" ]]; then
echo "Removing outdated container ..."
docker stop ${COMPOSE_PROJECT_NAME}_l3d
docker rm ${COMPOSE_PROJECT_NAME}_l3d
ID=
fi
fi
fi fi
ID=$(docker container ls -q -f name=${COMPOSE_PROJECT_NAME}_l3d)
if [[ -n "$ID" ]]; then if [[ -n "$ID" ]]; then
docker start ${COMPOSE_PROJECT_NAME}_l3d docker start ${COMPOSE_PROJECT_NAME}_l3d
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment