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 <strong>--architecture=os.linux.x86_64</strong> ../dashboard-build
cd ../dashboard-build && tar -zxvf dashboard.tar.gz
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.
bash -c "cd /bundle/programs/server &&
npm install &&
npm install fibers &&
npm install bcrypt"
command: node /bundle/main.js
With this small file in hands, the last bit is to execute Docker and watch the magic happen.
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