This piece of software mostly derives from the work of meteor-launchpad. At first I was thinking about submitting PR, but I reconsidered when I found I did too many modifications in jshimko code !
Using this docker image as a base for your dockerized Meteor projects enables you to:
- choose your flavor of
NodeJS - choose your version of
Meteoryou want to build against (helps with testing with new versions) - let you add extra packages if needed
- use directly your
settings.jsonfile without any need to take care of it - install
Meteordirect dependencies:MongoDBif you want to have a all-in-one Meteor package to deploy (not recommanded for production environment)NginXif you want to serve static files directly from it (highly recommanded for production environment)
This image is based on the official NodeJS packaged Docker images.
Mostly it provides a ground layer to build your Meteor apps upon. You can use it in two ways:
- use the prebuilt Docker image
- build your own customized launchpad image
You can do that simply by starting your Dockerfile with :
FROM oorabona/meteor-dockerpad:dev
If you want to use the development version of DockerPad. Roughly difference between the two are about NodeJS version used. By default, development always use the latest NodeJS version (latest or stretch). production environment use at the moment NodeJS version codenamed BORON.
FROM oorabona/meteor-dockerpad:boron
I do not know yet if I will maintain these versions alongside with official
NodeJS versions. As a matter of fact this is why there is a build.sh script.
If for whatever reason you want to customize the build, it will be just a matter of minutes to do so.
$ git clone this repo
$ NODE_VERSION=<your_version> ./build.sh [your_base_image_name]
$ ./build.sh mynamespace/mylaunchpad
This will build only the development version of the image. Now, if you want to go further in the production stages, you can iterate with version tags:
$ NODE_VERSION=<your_version> ./build.sh [your_base_image_name] [tag]
$ ./build.sh mynamepsace/mylaunchpad boron
And it will also produce the development version all at once !
Be very careful,
NODE_VERSIONis the only way to specify the NodeJS version you want to build against. I.e. issuing the following commandNODE_VERSION=stretch ./build.sh mynamespace/mylaunchpad boronwill produce an image namedmynamespace/mylaunchpad:boronbut withstretchNodeJS !!!
I designed this to work this way to allow maximum flexibility wether you feel like you want to version your images or just put dev and prod tags.
Flexibility comes at a certain price for sure.
As you can see from the Dockerfile, scripts are ONBUILD meaning they will re-run everytime you build your derived images.
That allows most of the customisation described below:
| Environment variable | Description | Present in launchpad.conf |
Default value |
|---|---|---|---|
| APT_GET_INSTALL | Put here all packages you would need to install with apt |
No | No |
| TOOL_NODE_FLAGS | Additional node flags to pass when building your project |
No | No |
| METEOR_VERSION | Meteor version to download and build against | Yes | Value taken from .meteor/release |
| METEOR_SETTINGS_FILE | The Meteor settings.json file you want to use |
Yes | settings.json |
| INSTALL_MONGO | Name says it all, if you want to install set it to true |
Yes | No |
| INSTALL_NGINX | Name says it all, if you want to install set it to true |
Yes | No |
Note:
launchpad.conffile has precedence overENVvariables (evenONBUILDones) defined in theDockerfile.
This docker image relies on su-exec instead of gosu and installs it to /usr/local/bin/.
Reason for that is that this very important tool does not need all the
Golanguage and its overwhelming dependencies at all to be efficient. So, to minimize image size and maximize efficiency, the bareCversion is more than enough 😄
What it does:
- Installs user prerequisites with apt-get
- Copy source code to container path
/opt/meteor/src - Download and install Meteor based on the version found in
.meteor/release - Installs npm prerequisites if
package.jsonis found - Put some safe place under
/etcyour settings.json file for use later. It uses environment variableMETEOR_SETTINGS_FILEfor that purpose if you want to customize its name - It checks whether you want to install MongoDB or not (
INSTALL_MONGOenvironment variable see above) and do the work - It checks whether you want to install NginX or not (
INSTALL_NGINXenvironment variable see above) and do the work - Builds the Meteor project using
--productionflag - It finishes
npm install-ation on the server side - It cleans up working directories (source, Meteor installation...)
- And cleans the container of everything that is no longer necessary
Of course @jshimko, @docker and the @meteor team for all their outstanding work !
This is of course MIT based license !
Feel free to submit issues and PR are most welcomed too ! 😄