Getting started with Fig and MEAN.JS
Docker is an open-source project to easily create lightweight, portable and self-sufficient containers from any application.
Fig.sh is a tool to use docker for makeing a fast, isolated development environments.
MEAN.JS MEAN means Mongodb, Express.js, Angular.js and Node.js. MEAN is a seed to setup a MEAN project quickly.
__more infomation your can see the offical site.*
This tutorial will tell you how to setup dockerizing MEAN project use less 20 mins(dependent on your network).
Prerequisites
You need have Docker
, fig
, If you are useing Mac your need boot2docker
.
Ensure all the tools were installed:
Get the MEAN.JS
Download the yo and install MEAN.JS with yo.
Run the docker with fig
If you use Mac, you neet run the docker host first.
change the DB connect URL from mongodb://localhost/mean-dev
to mongodb://db/mean-dev
. config file is config/env/development.js
Run $ fig up
and open http://docker-host-ip:3000
That’s it. very simple.
But if you realy develop on this docker env
You mast don’t like to build the docker image every time. So you can mount the local development folder ./
to docker container.
It is very easy too. Just config the fig.yml
under the web section
Then when you change any thing in you local code folder, the running doceker container will change immediately.
But if you are useing Mac, it will be super slowly.
because, there is performance issue when VirtualBox shell a folder from mac to boot2docker. I finded out the key is node_modules
folder. If I don’t mount the node_modules
folder, the preformance is ok. So my solution is mount the other folder individual.
the fig.yml
will like:
That is all. :)