Docker image to run Meteor apps. Includes datadog plugin.
- One image supports every Meteor version
- Automatically uses correct node and npm version
- Runs app as non-root user
- Compatible with Meteor up
hubroedu/meteor:root
Compatible with meteord. Runs the app as the root user and has phantomjs installed. Notes below about permissions do not apply to this image.
This image runs the app with the app
user. The owner of any files or folders your app uses should be changed to app
.
In your mup config, change app.docker.image
to hubroedu/meteor
.
You can create the bundle with the meteor build
command. The bundle should be available in the container at /bundle/bundle.tar.gz
.
Create a file named Dockerfile
and add the following:
FROM hubroedu/meteor
COPY --chown=app:app ../path/to/bundle.tar.gz /bundle/bundle.tar.gz
Then build and run the image with
docker build --build-arg NODE_VERSION=<node version> -t meteor-app .
docker run --name my-meteor-app meteor-app
And your app will be running on port 3000
The --build-arg NODE_VERSION=<node version>
is optional, and only needed if a command in your docker file will use node or npm.
Run
docker run --name my-meteor-app -v /path/to/folder/with/bundle:/bundle -p 3000:3000 -e "ROOT_URL=http://app.com" hubroedu/meteor
Built app
refers to an uncompressed bundle that already has had it's npm dependencies installed.
When using a compressed bundle, the bundle is decompressed and the app's npm dependencies are installed every time the app is started, which can take a while. By using this method instead, both steps are done before the container is started, allowing it to start much faster. Meteor up's Prepare Bundle
feature uses this.
Before following the instructions in either of the next two sections, build your app with meteor build --directory ../path/to/put/bundle
.
The bundle should be available in the container at /built_app
.
Create a file named Dockerfile
and copy the following into it:
FROM hubroedu/meteor
COPY --chown=app:app ./path/to/bundle /built_app
RUN cd /built_app/programs/server && npm install
Then build and run your image with:
docker build -t meteor-app --build-arg NODE_VERSION="node version" .
docker run --name my-meteor-app -p 3000:3000 -e "ROOT_URL=http://app.com" meteor-app
If possible, you should create a docker image as described in the previous instructions since it is more reliable.
First, make sure you have the correct version of node installed for the Meteor version your app uses, and then run
cd /path/to/bundle
cd programs/server
npm install
Next, start the docker container with
docker run --name my-meteor-app -v /path/to/bundle:/built_app -p 3000:3000 -e "ROOT_URL=http://app.com" hubroedu/meteor
When using a compressed bundle, you can specify the arguments used when running npm install
by setting the environment variable NPM_INSTALL_OPTIONS
.