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:
|
||||
@- echo "\n### pulling image(s)"
|
||||
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
||||
docker --context $(ctx) pull $(DOCKER_IMAGE); \
|
||||
docker context use $(ctx); \
|
||||
docker pull $(DOCKER_IMAGE); \
|
||||
)
|
||||
|
||||
pull-swarm:
|
||||
|
||||
start-compose:
|
||||
@- echo "\n### starting service(s)"
|
||||
@- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1`
|
||||
@- $(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:
|
||||
@- echo "\n### starting service(s)"
|
||||
|
@ -45,27 +49,40 @@ start-swarm:
|
|||
|
||||
stop-compose:
|
||||
@- echo "\n### stopping service(s)"
|
||||
@- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1`
|
||||
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
||||
docker-compose --host $(ctx) down; \
|
||||
)
|
||||
|
||||
docker context use $(ctx); \
|
||||
docker-compose down; \
|
||||
)
|
||||
@- docker context use $(stored_ctx)
|
||||
|
||||
stop-swarm:
|
||||
@- echo "\n### stopping service(s)"
|
||||
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
||||
docker --context $(ctx) stack rm $(DEPLOY_NAME); \
|
||||
)
|
||||
|
||||
@- docker context use $(stored_ctx)
|
||||
|
||||
logs-compose:
|
||||
@- 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:
|
||||
@- 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:
|
||||
@- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1`
|
||||
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
||||
docker-compose --host $(ctx) restart; \
|
||||
docker context use $(ctx); \
|
||||
docker-compose restart; \
|
||||
)
|
||||
|
||||
@- docker context use $(stored_ctx)
|
||||
|
||||
reload-compose:
|
||||
|
|
Loading…
Reference in New Issue