S
S
Sergey Popov2018-10-28 08:15:43
Docker
Sergey Popov, 2018-10-28 08:15:43

Docker image for building microservices from different repositories?

Good afternoon!
The problem is this. There is a legacy architecture that includes 7 different services, each of which is in its own repository on Bitbucket and does not include Docker. It is necessary to build an image that will allow you to run certain versions (depending on the branch and state in the git, including local changes) of each individual module.
What decision did I come to? There is something like this file structure:

| etc #Конфиги для загрузки nginx, mysql, redis, fpm и т.п.
| services
| - service1
| - - src 
| - - Dockerfile 
| docker-compose.yml

What am I doing.
To launch the entire group, we first need to pull the source code for the corresponding projects into services into each subfolder (service1, service2) (it is desirable to automate this stage as well). Then, for each image, I have a dockerfile (and I need to push it into the repository too, but this will require changes on the server).
docker-compose creates 7 different containers - one for each of the projects from the Dockerfile for each of them + redis + mysql. There is an internal subnet for all projects - project and there are ports forwarded to the outside.
That is, we knock on localhost: 8080 - project1, localhost: 8081 - project2.
However, I believe that this is a bit of a messy way. Are there alternatives? How else can this be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Q
qq1, 2018-10-28
@be_a_dancer

For the dev environment, you can make a master repository with docker-compose.yml, add turnips with services to it via git submodules . Usually they do this if the services are in different turnips, like yours. You can also consider the option with a mono-turnip, each approach has its pros and cons.
For production, if it is, for example, swarm or kubernetes, you will need your own docker registry from which images of container services will be taken.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question