Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review using docker compose #2

Open
bjarneo opened this issue Nov 13, 2024 · 2 comments
Open

Review using docker compose #2

bjarneo opened this issue Nov 13, 2024 · 2 comments

Comments

@bjarneo
Copy link
Owner

bjarneo commented Nov 13, 2024

Move from plain docker to use docker compose. Easier to handle config & replicas.

@back-2-95
Copy link

Snippet from our makefile (deploys a Symfony application):

SSH_TESTING := some_remote_host
SSH_PRODUCTION := some_remote_host

PHONY += --deploy
--deploy: export COMPOSE_FILE := compose.live.yaml
--deploy: export DOCKER_HOST := ssh://$(SSH)
--deploy:
	$(eval BUILD := $(shell ssh $(SSH) "docker inspect -f '{{ index .Config.Labels \"gha.build\" }}' $(PROJECT)-$(INSTANCE)"))
	BUILD=$(BUILD) op run --env-file="./.env.$(INSTANCE)" -- docker compose config
	BUILD=$(BUILD) op run --env-file="./.env.$(INSTANCE)" -- docker compose up --wait --remove-orphans
	BUILD=$(BUILD) op run --env-file="./.env.$(INSTANCE)" -- docker compose exec app bin/console --ansi cache:clear
	BUILD=$(BUILD) op run --env-file="./.env.$(INSTANCE)" -- docker compose exec app bin/console --ansi about

PHONY += deploy-testing
deploy-testing: INSTANCE := test
deploy-testing: SSH := $(SSH_TESTING)
deploy-testing: --deploy ## Deploy to Testing

PHONY += deploy-production
deploy-production: INSTANCE := prod
deploy-production: SSH := $(SSH_PRODUCTION)
deploy-production: --deploy ## Deploy to Production

So here you can run this like:

Deploy a certain (new) build (we use it within docker image tag):

make deploy-testing BUILD=123

Or re-reploy current build (it gets currently running build number from running container):

make deploy-testing

@bjarneo
Copy link
Owner Author

bjarneo commented Nov 13, 2024

Thank you, great information to add!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants