Answer the question
In order to leave comments, you need to log in
How to implement gitlab ci using docker-compose?
Not dev-ops, but the task was to write a system for continuous integration of the project with Gitlab. The project is built using docker-compose. The purpose of the task is to automatically build docker images at the output that can be deployed on the server, so far without testing and even without cd (manually update running containers on the server).
I'm not very sure about the strategy for implementing this task. Are all images stored in the gitlab docker registry? After all, docker-compose can have several dependent containers: database, backend, web socket server, etc.
How to connect them with each other in the gitlab registry so that you can run them on the server with one command. Or is it impossible to do without an automatic cd?
I would be very glad if you share how these tasks are usually done in general. Also would be glad for useful links. I myself will google more, but I asked for help. time is running out.
Answer the question
In order to leave comments, you need to log in
In short, something like this.
1. Take DB images from off repository, upload only configuration files if required via docker-compose.
2. Collect the application image either on shared runners or on your own runner.
3. Push the assembled image to the gitlab repository.
4. On the server where to deploy the gitlab runner, attach a tag to it.
5. Specify gitlab repository/imagename:tag as image in docker compose
6. Add 2 stages in gitlab ci. 1 is building and pushing docker images, 2 is running on installed runner docker-compose up -d
as an example, you can take something here.
https://github.com/MindPhaser34/my-portfolio/tree/...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question