docker.mk: -v

This commit is contained in:
Andreas Neue 2022-11-07 16:57:58 +01:00
parent 75dc88b3a3
commit a177dca1f6
1 changed files with 8 additions and 1 deletions

View File

@ -5,12 +5,14 @@ stored_ctx = 'default' # HACK
create-docker-contexts:
@- $(foreach host,$(DEPLOY_HOSTS), \
docker context create $(host) --description "$(host)" --docker "host=ssh://$(SSH_USER)@$(host)"; \
echo "$(host)"; \
docker context create $(host) --description "$(host)" --docker "host=ssh://$(SSH_USER)@$(host)"; \
)
pull-compose:
@- echo "\n### pulling image(s)"
@- $(foreach ctx,$(DEPLOY_HOSTS), \
echo "$(host)"; \
docker context use $(ctx); \
if test $(DOCKER_LOGIN) -eq 1 ; \
then \
@ -24,6 +26,7 @@ pull-swarm:
start-compose:
@- echo "\n### starting service(s)"
@- $(foreach ctx,$(DEPLOY_HOSTS), \
echo "$(host)"; \
docker context use $(ctx); \
docker-compose up -d; \
)
@ -32,6 +35,7 @@ start-compose:
start-swarm:
@- echo "\n### starting service(s)"
@- $(foreach ctx,$(DEPLOY_HOSTS), \
echo "$(host)"; \
docker --context $(ctx) stack deploy -c stack.yml $(DEPLOY_NAME); \
)
@- docker context use $(stored_ctx)
@ -39,6 +43,7 @@ start-swarm:
stop-compose:
@- echo "\n### stopping service(s)"
@- $(foreach ctx,$(DEPLOY_HOSTS), \
echo "$(host)"; \
docker context use $(ctx); \
docker-compose down; \
)
@ -47,6 +52,7 @@ stop-compose:
stop-swarm:
@- echo "\n### stopping service(s)"
@- $(foreach ctx,$(DEPLOY_HOSTS), \
echo "$(host)"; \
docker --context $(ctx) stack rm $(DEPLOY_NAME); \
)
@- docker context use $(stored_ctx)
@ -65,6 +71,7 @@ logs-swarm:
restart-compose:
@- $(foreach ctx,$(DEPLOY_HOSTS), \
echo "$(host)"; \
docker context use $(ctx); \
docker-compose restart; \
)