Reputation: 1452
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)
Approach 2: (building in aws)
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!
Upvotes: 4
Views: 2713
Reputation: 1075
If you build it in GitLab runners and push it to a registry, you can use it in more places that only on AWS.
Here is a reference file for the Docker-in-Docker build method(from docs):
.gitlab-ci.yml
build:
image: docker:stable
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
stage: build
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.example.com
- docker build -t registry.example.com/group/project/image:latest .
- docker push registry.example.com/group/project/image:latest
Upvotes: 2