Docker and grunt workflow automation

I'm looking for a Docker based project setup that allows:

  • Development environment most closely matches production
  • The best workflow automation tools for all developers
  • High performance / fast set up development environment that supports Linux, OSX and Windows. We are currently using Vagrant and this seems to be the most obvious choice.

To satisfy # 1:

  • Same application container (node.js + Apache) for developer, test, staging and production
  • Do not add any custom workflow tools to the container.

To satisfy # 3:

  • It is not required for developers to install their own development tools for their respective environments / OS (e.g. to install them in w631> .js, npm, grunt, etc. inside the host)

So, to satisfy # 2, the idea I have is:

  • there is a second container "dev" that shares files with the node / apache container and starts all the workflow automation.
  • start all grunt / rebuild / reload / browser-sync etc. from the inside.
  • If you are using Vagrant, file sharing will essentially take place in the hosts-> dev container-> app container

Are there any downsides to the above model, or maybe better ideas?

One potentially missing point is whether - and if so, how - to avoid performing a full container assembly during production every time. Without risking product mismatch and other containers, I would like to "package" the container so that when new code is introduced to the application server, it has to be restarted instead of installing npm, etc. In particular, when we are "in order to work", he no longer needs to pull anything from third-party servers.

+3


source to share


1 answer


This is a bit of a broad question, in which the answers would rather be flawed and then backed up with objective arguments, but here I would change there:

  • Node.js is fine, but I would choose nginx over Apache. Both Node.js and Nginx are event based and provide much more bandwidth, which is one of the benefits of Node.js. But that might change, for example, if you need certain Apache modules, but Nginx seems more natural to put Node.

  • Why do you want to have a separate container? To minimize the production container so it doesn't have developer tools?



I do think that having, say, grunt.js

a working container is not too heavy, but again you are trying to minimize the impact. In any case, you can also have a single code, grunt watch

and so on. Inside one container and deploy like this. The pros are that you make it easier to set up, but because your production build might have a few additional libraries installed. Which you can mitigate, for example by setting NODE_ENV to production when deploying a production container so that when you run your scripts know not to load certain developer tools.

+1


source







All Articles