docker.mk: dont change context persistently
This commit is contained in:
parent
53ef6d3032
commit
b24062bfc3
41
docker.mk
41
docker.mk
|
@ -26,16 +26,20 @@ 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 $(ctx) pull $(DOCKER_IMAGE); \
|
docker context use $(ctx); \
|
||||||
|
docker pull $(DOCKER_IMAGE); \
|
||||||
)
|
)
|
||||||
|
|
||||||
pull-swarm:
|
pull-swarm:
|
||||||
|
|
||||||
start-compose:
|
start-compose:
|
||||||
@- echo "\n### starting service(s)"
|
@- echo "\n### starting service(s)"
|
||||||
|
@- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1`
|
||||||
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
||||||
docker-compose --host $(ctx) up -d; \
|
docker context use $(ctx); \
|
||||||
|
docker-compose up -d; \
|
||||||
)
|
)
|
||||||
|
@- docker context use $(stored_ctx)
|
||||||
|
|
||||||
start-swarm:
|
start-swarm:
|
||||||
@- echo "\n### starting service(s)"
|
@- echo "\n### starting service(s)"
|
||||||
|
@ -45,27 +49,40 @@ start-swarm:
|
||||||
|
|
||||||
stop-compose:
|
stop-compose:
|
||||||
@- echo "\n### stopping service(s)"
|
@- echo "\n### stopping service(s)"
|
||||||
|
@- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1`
|
||||||
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
||||||
docker-compose --host $(ctx) down; \
|
docker context use $(ctx); \
|
||||||
)
|
docker-compose down; \
|
||||||
|
)
|
||||||
|
@- docker context use $(stored_ctx)
|
||||||
|
|
||||||
stop-swarm:
|
stop-swarm:
|
||||||
@- echo "\n### stopping service(s)"
|
@- echo "\n### stopping service(s)"
|
||||||
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
||||||
docker --context $(ctx) stack rm $(DEPLOY_NAME); \
|
docker --context $(ctx) stack rm $(DEPLOY_NAME); \
|
||||||
)
|
)
|
||||||
|
@- docker context use $(stored_ctx)
|
||||||
|
|
||||||
logs-compose:
|
logs-compose:
|
||||||
@- echo "\n### logs"
|
@- echo "\n### logs"
|
||||||
@- docker-compose --host $(ctx) logs -f $(service)
|
@- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1`
|
||||||
|
@- docker context use $(host)
|
||||||
|
@- docker-compose logs -f $(service)
|
||||||
|
@- docker context use $(stored_ctx)
|
||||||
|
|
||||||
logs-swarm:
|
logs-swarm:
|
||||||
@- echo "\n### logs"
|
@- echo "\n### logs"
|
||||||
@- docker --context $(ctx) service logs -f $(service)
|
@- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1`
|
||||||
|
@- docker context use $(DEPLOY_HOSTS)
|
||||||
|
@- docker service logs -f $(service)
|
||||||
|
@- docker context use $(stored_ctx)
|
||||||
|
|
||||||
restart-compose:
|
restart-compose:
|
||||||
|
@- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1`
|
||||||
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
||||||
docker-compose --host $(ctx) restart; \
|
docker context use $(ctx); \
|
||||||
|
docker-compose restart; \
|
||||||
)
|
)
|
||||||
|
@- docker context use $(stored_ctx)
|
||||||
|
|
||||||
reload-compose:
|
reload-compose:
|
||||||
|
|
Loading…
Reference in New Issue