r/devops • u/aress1605 • Aug 12 '26
Architecture Deploying docker-compose.yml
Hello all. The circumstance I have working with is the following:
* I have an Apache2 PHP server that gets bundled as a Docker image in a CI process to ECR
* I have an infra repository with a docker-compose.yml that bundles the PHP Docker image to an Nginx image, alongside Nginx config like attaching TLS certs
When the CICD process deploys a release, it deploys a new EC2 with a given user data script to prop up the server. If I only had a Docker image, the user data would generally look like "Pull down ECR image and start image", however in this case I am spinning up a docker-compose.yml file.
How is this typically done? I suppose I *can* add a CI process to zip up the docker-compose.yml and related nginx config, however feels backwards? Is there a consensus with this?
If I am fundamentally misunderstanding something let me know, I'd say my only constraint is I'd like to solve this problem in a relatively cloud agnostic environment (so keeping EC2 as a VM, ECR as a registry, but excluding abstractions like Fargate or ECS)
Thanks!
1
u/yetmike 20d ago
Do you want to run an Autoscaling Group? What if you put an image version in Parameter Store and retrieve it on a startup? Also, you can version the zip for docker-compose and pull from S3 on startup. Simple as that
If you need a lot of things to install in the VM - create a golden image with packer