docker-composer with extra file and project parameter
This commit is contained in:
parent
f421740543
commit
b309a5bce0
|
@ -0,0 +1,36 @@
|
|||
MANDATORY-compose = DEPLOY_HOSTS DEPLOY_TYPE TAG DEPLOY_COMPOSE_FILE DEPLOY_COMPOSE_PROJECT
|
||||
|
||||
pull-compose:
|
||||
@- echo "\n### pulling image(s)"
|
||||
@- $(foreach host,$(DEPLOY_HOSTS), \
|
||||
echo "$(host)"; \
|
||||
if test $(DOCKER_LOGIN) -eq 1 ; \
|
||||
then \
|
||||
ssh $(SSH_USER)@$(host) "docker login -u $(DOCKER_USER) -p $(DOCKER_PASS) $(DOCKER_REGISTRY)"; \
|
||||
fi; \
|
||||
ssh $(SSH_USER)@$(host) "docker pull $(DOCKER_IMAGE)"; \
|
||||
)
|
||||
|
||||
start-compose:
|
||||
@- echo "\n### starting service(s)"
|
||||
@- $(foreach host,$(DEPLOY_HOSTS), \
|
||||
echo "$(host)"; \
|
||||
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose -f $(DEPLOY_COMPOSE_FILE) -p $(DEPLOY_COMPOSE_PROJECT) up -d"; \
|
||||
)
|
||||
|
||||
stop-compose:
|
||||
@- echo "\n### stopping service(s)"
|
||||
@- $(foreach host,$(DEPLOY_HOSTS), \
|
||||
echo "$(host)"; \
|
||||
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose -f $(DEPLOY_COMPOSE_FILE) -p $(DEPLOY_COMPOSE_PROJECT) down"; \
|
||||
)
|
||||
|
||||
logs-compose:
|
||||
@- echo "\n### logs"
|
||||
@- ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose -f $(DEPLOY_COMPOSE_FILE) -p $(DEPLOY_COMPOSE_PROJECT) logs -f $(service)"
|
||||
|
||||
restart-compose:
|
||||
@- $(foreach host,$(DEPLOY_HOSTS), \
|
||||
echo "$(host)"; \
|
||||
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose -f $(DEPLOY_COMPOSE_FILE) -p $(DEPLOY_COMPOSE_PROJECT) restart"; \
|
||||
)
|
Loading…
Reference in New Issue