Automated Docker container with ONBUILD to build/deploy Meteor projects
969
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:
NodeJSMeteor you want to build against (helps with testing with new versions)settings.json file without any need to take care of itMeteor direct dependencies:
MongoDB if you want to have a all-in-one Meteor package to deploy (not recommanded for production environment)NginX if 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:
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 :smile:
What it does:
/opt/meteor/src.meteor/releasepackage.json is found/etc your settings.json file for use later. It uses environment variable METEOR_SETTINGS_FILE for that purpose if you want to customize its nameINSTALL_MONGO environment variable see above) and do the workINSTALL_NGINX environment variable see above) and do the work--production flagnpm install-ation on the server sideOf 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 ! :smile:
Content type
Image
Digest
Size
272 MB
Last updated
over 8 years ago
docker pull oorabona/meteor-dockerpad