kentor
kentor

Reputation: 18524

Dockerizing multiple microservices in mono repository

I want to dockerize a REST Api which uses multiple microservices. Most tutorials only cover very simple cases so I am a bit stuck about how to properly dockerize such a project.

My project structure:

So it has three microservices (request-worker, request-manager and the rest-api).

My question:

Is a .dockerignore and Dockerfile for each microservice necessary or how would one properly dockerize such a mono repository project?

Upvotes: 2

Views: 597

Answers (1)

NayoR
NayoR

Reputation: 721

You can create one Dockerfile per microservice, but will probably have several conflicts and problems due to the fact that they are sharing multiple files (node_modules especialy).

I recommand use one (sub)repository for each service:

  • request-manager
    • Dockerfile
    • src
    • node_modules
    • test
    • package.json
    • tsconfig.json
  • request-worker
    • Dockerfile
    • src
    • node_modules
    • ...
  • rest-api
    • ...
  • shared

And be very careful at what you put in shared folder.

You also can use docker-compose for managing dependancies.

Upvotes: 2

Related Questions