We are building Meteor apps and need to deploy them into our in-house Docker infrastructure. We use the same infrastructure to deploy other Node based services. We usually use Jenkins for the CI portion.
My Docker guy seems to struggle with deploying Meteor. He is trying to treat Meteor as “just another” Node app, building on top of our standard Node environment. He is complaining that his jobs are slow and indeed it takes about 30 minutes for the deploy to run. It often fails for one reason or another.
What is the best practice to deploy Meteor apps on to Docker? Since our approach really doesn’t seem to work well.
The way we do it (we use TeamCity, but I would expect it to be similar for any build server) is to have Meteor installed on our build agent. We also have a base “Meteor app” docker image, which is just the appropriate versions of Node, Nginx (for static files), etc. The build agent checks out the source code, runs the meteor build command, and then uses a Dockerfile via docker build to copy the bundled Meteor app into an image based off our Meteor base image and run npm install. I haven’t optimized the build agent yet (we’re currently just running this off our SAN with 7200 RPM drives, no SSDs or RAM drives at this point) and the builds generally take between 2 and 15 minutes depending on the size of the app, the version of Meteor, and whether or not the node_modules are cached from a previous build.
The build agent then stores the image in our local docker registry and notifies our deployment server (we use Octopus Deploy) which sets environment-specific settings and automatically deploys to our test environment, which takes 3-10 seconds. Subsequent (manually triggered) deploys to staging and production also take 3-10 seconds thanks to Docker.
It certainly takes a lot longer than our simpler projects (small node apps, wordpress sites, etc, which generally take less than 30 seconds to build), but the time yours is taking seems really high to me.