Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Docker image for Meteor.

License

NotificationsYou must be signed in to change notification settings

zodern/meteor-docker

Repository files navigation

GitHub Workflow StatusDocker Pulls

Docker image to run Meteor apps.

Features

  • One image supports every Meteor version (tested with 1.2 - 2.13 and newer)
  • Mostly supports Meteor 3 (requires makingprograms/server/shrinkwrap.jsonwritable due to a bug in Meteor 3)
  • Automatically uses correct node and npm version
  • Runs app as non-root user
  • Compatible with Meteor up

Tags

  • zodern/meteor The recommended version. Runs the app as a non-root user.
  • zodern/meteor:root Compatible with meteord. Runs the app as the root user and has phantomjs installed. Any notes below about permissions do not apply to this image.
  • zodern/meteor:slim Coming soon. Is a smaller image without node or npm pre-installed. During ONBUILD or when starting the app, it will install the correct version.

How To Use

Permissions

This image runs the app with theapp user. The owner of any files or folders your app uses inside the Docker container should be changed toapp.

Meteor Up

In your mup config, changeapp.docker.image tozodern/meteor.

If you want to use mup'sbuildInstructions option to run commands as root, you can do so by temporarily changing the user:

buildInstructions: [  'USER root',  'RUN apt-get update && apt-get install -y imagemagick graphicsmagick',  'USER app']

Compressed bundle

You can create the bundle with themeteor build command. The bundle should be available in the container at/bundle/bundle.tar.gz.

Dockerfile

Create a file namedDockerfile and add the following:

FROM zodern/meteorCOPY --chown=app:app ../path/to/bundle.tar.gz /bundle/bundle.tar.gz

Then build and run the image with

docker build --build-arg EXACT_NODE_VERSION=<true|| false> --build-arg NODE_VERSION=<node version> -t meteor-app.docker run --env NODE_VERSION=<node version> --env EXACT_NODE_VERSION=<true|| false> --name my-meteor-app meteor-app

And your app will be running on port 3000

The(--build-arg || --env) NODE_VERSION=<node version> is optional, and only needed if a command in your docker file will use a specific node or npm version.

If any Node versions inimage/setup/versions.json match the same major version of Node your app needs, the version inversions.json is used instead since it will have additional security fixes missing in the version Meteor specifies. If there is no matching major version, it will use the exact version Meteor specifies. To always use the exact version, you can use set(--build-arg || --env) EXACT_NODE_VERSION=true

Volume

Run

  docker run --name my-meteor-app -v /path/to/folder/with/bundle:/bundle -p 3000:3000 -e"ROOT_URL=http://app.com" zodern/meteor

Built app

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'sPrepare Bundle feature uses this.

Before following the instructions in either of the next two sections, build your app withmeteor build --directory ../path/to/put/bundle.

The bundle should be available in the container at/built_app.

Docker Image

Create a file namedDockerfile and copy the following into it:

FROM zodern/meteorCOPY --chown=app:app ./path/to/bundle /built_appRUN 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

Volume

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/bundlecd programs/servernpm 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" zodern/meteor

Options

NPM_INSTALL_OPTIONS

When using a compressed bundle, you can specify the arguments used when runningnpm install by setting the environment variableNPM_INSTALL_OPTIONS.

Contributing

Tests can be run withnpm test. The tests can not be run on Windows, though WSL does work. Docker should be installed before running the tests.

Commit messages should start with one of these to allow the changelog and version to be updated correctly:

  • fix: fixes a bug
  • feat: adds a feature
  • perf:
  • docs:
  • chore:
  • ci:

If the change is a breaking change, addBREAKING CHANGE: to the commit description


[8]ページ先頭

©2009-2025 Movatter.jp