docker.mk: dont change context persistently

This commit is contained in:
Andreas Neue 2022-07-18 16:43:29 +02:00
parent 91999ec9b5
commit 53ef6d3032
1 changed files with 6 additions and 12 deletions

View File

@ -26,8 +26,7 @@ post-deploy-docker:
pull-compose: pull-compose:
@- echo "\n### pulling image(s)" @- echo "\n### pulling image(s)"
@- $(foreach ctx,$(DEPLOY_HOSTS), \ @- $(foreach ctx,$(DEPLOY_HOSTS), \
docker context use $(ctx); \ docker --context $(ctx) pull $(DOCKER_IMAGE); \
docker pull $(DOCKER_IMAGE); \
) )
pull-swarm: pull-swarm:
@ -35,8 +34,7 @@ pull-swarm:
start-compose: start-compose:
@- echo "\n### starting service(s)" @- echo "\n### starting service(s)"
@- $(foreach ctx,$(DEPLOY_HOSTS), \ @- $(foreach ctx,$(DEPLOY_HOSTS), \
docker context use $(ctx); \ docker-compose --host $(ctx) up -d; \
docker-compose up -d; \
) )
start-swarm: start-swarm:
@ -48,8 +46,7 @@ start-swarm:
stop-compose: stop-compose:
@- echo "\n### stopping service(s)" @- echo "\n### stopping service(s)"
@- $(foreach ctx,$(DEPLOY_HOSTS), \ @- $(foreach ctx,$(DEPLOY_HOSTS), \
docker context use $(ctx); \ docker-compose --host $(ctx) down; \
docker-compose down; \
) )
stop-swarm: stop-swarm:
@ -60,18 +57,15 @@ stop-swarm:
logs-compose: logs-compose:
@- echo "\n### logs" @- echo "\n### logs"
@- docker context use $(host) @- docker-compose --host $(ctx) logs -f $(service)
@- docker-compose logs -f $(service)
logs-swarm: logs-swarm:
@- echo "\n### logs" @- echo "\n### logs"
@- docker context use $(DEPLOY_HOSTS) @- docker --context $(ctx) service logs -f $(service)
@- docker service logs -f $(service)
restart-compose: restart-compose:
@- $(foreach ctx,$(DEPLOY_HOSTS), \ @- $(foreach ctx,$(DEPLOY_HOSTS), \
docker context use $(ctx); \ docker-compose --host $(ctx) restart; \
docker-compose restart; \
) )
reload-compose: reload-compose: