I have a Symfony app that runs with docker-compose and I want to implement the auto-deployment with GitLab CI/CD, to run the app in some aws instance. I don't know what would be the best approach to take, basically this are my ideas and their steps:
Approach 1: (building in GitLab)
- Build the docker images in the GitLab runners
- Push the images to some image registry
- ssh to the aws instance
- pull the new image
- run the new containers with docker-compose
Approach 2: (building in aws)
- ssh to aws
- pull the branch to deploy
- build the docker images
- run the new containers with docker-compose
I like the first approach but maybe there is another better way to do it. It would be amazing to have some .gitlab-ci.yml reference file.
Thanks!