DEV Community

Discussion on: Using Docker for Node.js in Development and Production

Collapse
 
hamsterasesino profile image
Gabriel • Edited

Hi Alex, thanks for the excellent article.

I am developing something similar at work and I have a question regarding docker compose and shared volumes that I hope you could help me with.

Basically I designed the Docker Environment so the web application was split up between code and a proxy server (nginx).

The container holding the code creates a shared volume, and then the container running Nginx serves its contents.

I made it this way so it would be easier in the future to replace Nginx with other servers (e.g. Apache).

Now my question is: do you think it is appropriate to initialize the container holding the code as a service in the docker-compose file? Its purpose is only to create the shared volume (it stops immediately after that).

I am sorry if this comes across as a very noob question but I didn't find anything against or in favor of this approach.

Thank you,
Gabriel

Collapse
 
alex_barashkov profile image
Alex Barashkov

Hi Gabriel,

I'm not quite sure that I understood what's exactly in your service. For example if it's something like webpack/gulp website you build and then use that built data as a part of a nginx container I don't see any problem with that.

I also have in my microservices docker compose file for one project, one service which I execute with empty command, because I have to built and then use some commands through it via docker-compose run

Collapse
 
hamsterasesino profile image
Gabriel

That's exactly it. It is a container that only compiles the code via webpack/grunt.

Thanks!