Few steps to Dockernizing Meteor apps

Hi there. Today let’s take a quick look in some few steps to Dockernizing Meteor apps.

In the last few days I’ve been playing with this and found some different solutions, even a variation of MeteorUp to deploy Docker containers carrying Meteor apps but there were not so suitable for me, I have some SSL restrictions some customizations to do so, I decided to do it by myself and guess what? Was not that hard, both Meteor and Docker do a great job to do our lives easier.

The build process

The build process to create a bundle from a meteor app is quite simple, four lines and the bundle is ready, this the script that I’ve been using in the root of my project.


meteor build --architecture=os.linux.x86_64 ../dashboard-build
cd ../dashboard-build && tar -zxvf dashboard.tar.gz
cd ../dashboard

The unique detail here that differ from a regular build process is the –architecture=os.linux.x86_64 parameter, I’d to use it because my host OS is a MacOS.

After these lines will notice that you have a directory called bundle inside dashboard-build, this is the exploded gzip file.

The containerization process

Here I’ve created another file in the root of my project, a docker-compose.yml with all the instructions necessary to build and start my Meteor app.

  image: node:4.4.7
    - ${PWD}/../dashboard-build/bundle:/bundle
    - "3000:3000"
    - mongo
    - MONGO_URL=mongodb://mongo/dashboard
    - ROOT_URL=http://something.some
    - PORT=3000
    - NODE_ENV=production
  command: >
    bash -c "cd /bundle/programs/server && 
           npm install && 
           npm install fibers &&
           npm install bcrypt"
  command: node /bundle/main.js
  image: mongo:latest
     - "27017:27017"

With this small file in hands, the last bit is to execute Docker and watch the magic happen.

docker-compose up

Done, you’ll see the logs going through your console. Now, just go to your browser and take a look at your beauty http://localhost:3000


Allan de Queiroz

Allan de Queiroz
London based software engineer

XServer forward from Linux text mode for Headless purposes.

Hello, this post is about XServer forward from Linux text mode, **not ssh forward, anything related to VNC** or things like that.Recently...… Continue reading