sh8s_deployer/notes/docker.md
2024-08-01 18:22:15 +02:00

776 B

docker_service="$(echo "$service" | tr '.' '_')"

deploy

if $deploy ; then
	section "Logging to registry"
	# XXX Login to docker registry

	section "Pulling images"
	docker-compose pull
	if [ "$?" -ne 0 ] ; then
		echo "PULL FAILED"
	fi

	section "Starting service"
	run docker-compose up -d --remove-orphans
	[ "$?" -ne 0 ] && echo "Erreur docker compose" && returncode=1
else
	section "Removing containers"
	run docker-compose down --rmi all --remove-orphans
fi

fi

clean

if ! "$deploy" ; then section "Remove stray containers" while read container ; do [ -z "$container" ] && continue || true echo "Removing $container" run docker rm "$container" done <<< "$(docker ps | grep "$docker_service" | cut -d ' ' -f 1)" fi