Giter Site home page Giter Site logo

docker-meteor's Introduction

Supported tags and respective Dockerfile links

What is Meteor?

Meteor is an ultra-simple environment for building modern web applications.

With Meteor you write apps:

  • in pure JavaScript
  • that send data over the wire, rather than HTML
  • using your choice of popular open-source libraries

Documentation is available at http://docs.meteor.com/.

What's included in these images?

Meteor and a small shim that addresses a compatibility issue with boot2docker.

A fork of demeteorizer with a patch for Dockerfile support remains included in this release. Support has been deprecated and demeteorizer will be dropped from future releases. The patch has not been merged upstream and demeteorizer is not required with the currently documented workflow.

Why use these images?

  • To install a packaged, specific version of Meteor.
  • To Dockerize a Meteor app for your Continuous Integration/Continuous Delivery/Production environments.
  • To have a repeatable and easily maintained development environment.
  • To do Meteor development on Windows (using boot2docker).

The latest tag builds whatever Meteor publishes at https://install.meteor.com/, as long as the install script does not change. Images tagged for a specific Meteor version checksum both the installer and the tarball the installer downloads.

How to use these images

Example: Create a new Meteor app

docker run -it --rm -v "$(pwd)":/app danieldent/meteor meteor create

Example: Meteor in Development Mode (Linux)

docker run -it --rm -p 3000:3000 -v "$(pwd)":/app danieldent/meteor

Example: Meteor in Development Mode (boot2docker - OS X/Windows)

Boot2Docker uses VirtualBox's Shared Folders for Docker's data volumes, which are not compatible with either MongoDB or Meteor's development server.

A small shim is included which re-maps the .meteor/local folder back into the virtual machine, and enables Meteor to work under boot2docker. Add vboxsf-shim before any meteor command that requires its use. Using the shim requires the container be allowed the SYS_ADMIN capability.

docker run --cap-add SYS_ADMIN -it --rm -p 3000:3000 -v "$(pwd)":/app danieldent/meteor vboxsf-shim meteor

You may wish to use a separate docker container for your database. This will allow data to persist across restarts of your Meteor container. Unless you use a persistent Docker container, using the shim means that the contents of your .meteor/local folder do not persist, which is where Meteor stores its build cache as well as the MongoDB database it provides in development mode.

docker run --name mydb -d mongo
docker run --cap-add SYS_ADMIN -it --rm -p 3000:3000 --link mydb:db -e "MONGO_URL=mongodb://db" -v "$(pwd)":/app danieldent/meteor vboxsf-shim meteor

Example: Dockerizing your Meteor App for CI/CD/Production Builds

Create a .dockerignore file in your Meteor source directory to exclude Meteor's development build cache.

.meteor/local

Create a Dockerfile for your Meteor app and place it in your Meteor source directory. Use one of the onbuild tags.

FROM danieldent/meteor:onbuild

Build the Docker image for your app (assumes you are currently in the Meteor source directory):

docker build -t exampleapp .

Run your app in its container, using another Docker container for the MongoDB database:

docker run --name exampleAppDb -d mongo
docker run -it --rm -p 3000:3000 --link exampleAppDb:db -e "MONGO_URL=mongodb://db" -e "ROOT_URL=http://localhost:3000" exampleapp

Defaults

By default, your Meteor app will run as nobody within the Docker container. This ensures the app does not have write access to its own files, which could help reduce the impact of certain security issues. It also makes it harder to accidentally write code which makes changes to the filesystem. Port 3000 will be exposed by default. Here's a Dockerfile which changes the defaults. It usually shouldn't be necessary to change the port on which your Meteor app listens - Docker's port mapping features allows the port used inside the container to be different than the port which is exposed outside the container.

FROM danieldent/meteor:onbuild
EXPOSE 4000
ENV PORT 4000
USER root

While it's possible to set additional variables as part of the build (such as MONGO_URL, ROOT_URL, or METEOR_SETTINGS), it may be a better choice to pass configuration that is likely to vary between deployments of the application as runtime environment variables.

Issues, Contributing

If you run into any problems with these images, please check for issues on GitHub. Please file a pull request or create a new issue for problems or potential improvements.

License

Copyright 2014-2015 Daniel Dent.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Third-party contents included in builds of the image are licensed separately.

docker-meteor's People

Contributors

danieldent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

docker-meteor's Issues

Document non-demeteorizer flow

Its possible to use these Dockerfiles as base files for a new set of ONBUILD Dockerfiles that make demeteorizer unnecessary for production builds. Document this and deprecate use of demeteorizer.

[Second life ?] 1.4 support

As dev showed in another issue brieve signal of a desire of updating this repo I open this issue to say that first thing to do is to stop using root as user, or to use the --allow-superuser option when launching meteor otherwise meteor is not gonna working (either to compile or to watch file in dev mode) giving the error message :

You are attempting to run Meteor as the 'root' superuser. If you are
developing, this is almost certainly *not* what you want to do and will likely
result in incorrect file permissions. However, if you are running this command
in a build process (CI, etc.), or you are absolutely sure you know what you are
doing, set the METEOR_ALLOW_SUPERUSER environment variable or pass
--allow-superuser to proceed.

I also want to know what is the future of this package, multiple updates on docker has been made but github hasn't been updated. As there's activity on this package I'm probably gonna use this dockerfile if your going to support this package in the future so could you please declare for devs like me your plans about this package.

Error: Module did not self-register.

When I try to run an existing Meteor app with the given instructions, I get the error below:

$ docker run -it --rm -p 3000:3000 --link my_appDb:db -e "MONGO_URL=mongodb://db" -e "ROOT_URL=http://localhost:3000" -e MY_KEY -e MY_USER my_app
/opt/bundle/programs/server/node_modules/fibers/future.js:245
                    throw(ex);
                          ^
Error: Module did not self-register.
    at Error (native)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at bindings (/opt/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/node_modules/bindings/bindings.js:74:15)
    at Object.<anonymous> (/opt/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/bcrypt.js:3:35)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)

I'm on Mac OS X with the following versions running:

$ node -v
v0.12.7
$ meteor --version
Meteor 1.1.0.3

$ boot2docker version
Boot2Docker-cli version: v1.7.0
Git commit: 7d89508

$ docker version
Client version: 1.7.0
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 0baf609
OS/Arch (client): darwin/amd64
Server version: 1.8.1
Server API version: 1.20
Go version (server): go1.4.2
Git commit (server): d12ea79
OS/Arch (server): linux/amd64

I've tried npm rebuild, but it didn't help.

There was a related issue in an earlier version of Meteor: meteor/meteor#3666

One of the comments suggested running this command to make sure my bcrypt binary is built for Linux rather than Mac, but I'm not sure where (locally? in the Dockerfile?):

meteor build --architecture os.linux.x86_64

meteor-tool 'throw new Error('Must throw non-empty error');'

Followed instructions and have attempted to do a build, got the following output:

docker build -t myAppname .
Sending build context to Docker daemon 13.99 MB
Step 1 : FROM danieldent/meteor:onbuild
# Executing 6 build triggers...
Step 1 : COPY . /opt/src
Step 1 : WORKDIR /opt/src
 ---> Running in 1453ed5c1223
Step 1 : RUN meteor build .. --directory     && cd ../bundle/programs/server     && npm install     && rm -rf /opt/src
 ---> Running in a677fdb41901

/root/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:259
                        throw new Error('Must throw non-empty error');
                              ^
Error: Must throw non-empty error
    at Object.Future.throw (/root/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:259:10)
    at Extract.<anonymous> (/tools/fs/files.js:699:42)
    at Extract.emit (events.js:117:20)
    at DirWriter.<anonymous> (/root/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/tar/lib/extract.js:61:8)
    at DirWriter.emit (events.js:117:20)
    at FileWriter.<anonymous> (/root/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/fstream/lib/dir-writer.js:158:12)
    at FileWriter.emit (events.js:92:17)
    at WriteStream.<anonymous> (/root/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/fstream/lib/file-writer.js:50:47)
    at WriteStream.emit (events.js:95:17)
    at WriteStream.<anonymous> (evalmachine.<anonymous>:1669:12)
    at OpenReq.Req.done (/root/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/graceful-fs/graceful-fs.js:141:5)
    at OpenReq.done (/root/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/graceful-fs/graceful-fs.js:61:22)
    at Object.oncomplete (evalmachine.<anonymous>:108:15)
The command '/bin/sh -c meteor build .. --directory     && cd ../bundle/programs/server     && npm install     && rm -rf /opt/src' returned a non-zero code: 8

Update for version 1.1.0.3?

Hi Daniel.

I'm using your docker images for my development and I really like it. I see that the last update is some time ago. Will you update to version .3 and later to 1.2?

Thanks for the great work.

Stefan

Npm caching

Is there any way to cache the npm process? I've done it in the past by copying package.json in and running npm install before the rest of the app files. Docker sees there are no changes to package.json and caches the commands.

Could it be possible to make a package.json for the base meteor app and copy that in and install first? That way caching a lot of the packages installed?

Package catalog for dev container

Hey,
Thanks for the container, works great ๐Ÿ‘
I'm not sure is it possible to solve as part of Dockerfile definition or a description needed to be added to README but I've noticed significant slow downs on startup of meteor app first time container is launched.
See example for a very small app(only 5 packages including core):

> du -d0Hm ~/.meteor/
308944  /root/.meteor/
> meteor
.....
> du -d0Hm ~/.meteor/
334412  /root/.meteor/

As soon as I stop the container it will reset back to 308944 as expected. Which means EVERY time I start a dev container for this app it will try to build up cache again which results in significant extra download.
Any ideas on how to fix it ? I've tried to mount ~/.meteor inside the container but it doesn't seem to work.

Checksum error

Hi!

I get a checksum error on 1.0.5 - can you explain how the SHA is generated? As it seems to not match:
Sending build context to Docker daemon 6.656 kB
Sending build context to Docker daemon
Step 1 : FROM node:0.10
---> 38c02af29fa3
Step 2 : MAINTAINER Daniel Dent (https://www.danieldent.com/)
---> Using cache
---> 92576d399b35
Step 3 : ENV METEOR_VERSION 1.0.5
---> Using cache
---> 3e4bbf01253d
Step 4 : ENV METEOR_INSTALLER_SHA256 4020ef4d3bc257cd570b5b2d49e3490699c52d0fd98453e29b7addfbdfba9c80
---> Using cache
---> 31c745647a41
Step 5 : ENV METEOR_LINUX_X86_32_SHA256 7dedd029f41082f0b009a9cf96ab729e2252553e7d19a9f96d11207ca049f464
---> Using cache
---> 6b0ad0074eb5
Step 6 : ENV METEOR_LINUX_X86_64_SHA256 77e011f6a8099ec3dc4527b635f3197896d698877da75e5365457e6a15b8979b
---> Using cache
---> f9b88cd5c931
Step 7 : ENV TARBALL_URL_OVERRIDE https://github.com/DanielDent/docker-meteor/releases/download/v${RELEASE}/meteor-bootstrap-${PLATFORM}-${RELEASE}.tar.gz
---> Using cache
---> 93ed897e29ed
Step 8 : COPY meteor-installer.patch /tmp/meteor/meteor-installer.patch
---> 7b3b64a31a86
Removing intermediate container ec632ae47485
Step 9 : COPY vboxsf-shim.sh /usr/local/bin/vboxsf-shim
---> 14fc86463e56
Removing intermediate container 4a7bdcfabec0
Step 10 : RUN curl -SL https://install.meteor.com/ -o /tmp/meteor/inst && sed -e "s/^RELEASE=./RELEASE="$METEOR_VERSION"/" /tmp/meteor/inst > /tmp/meteor/inst-canonical && echo $METEOR_INSTALLER_SHA256 /tmp/meteor/inst-canonical | sha256sum -c && patch /tmp/meteor/inst /tmp/meteor/meteor-installer.patch && chmod +x /tmp/meteor/inst && /tmp/meteor/inst && rm -rf /tmp/meteor
---> Running in 1996b592497c
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6674 0 6674 0 0 130 0 --:--:-- 0:00:51 --:--:-- 1767
/tmp/meteor/inst-canonical: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match
INFO[0059] The command '/bin/sh -c curl -SL https://install.meteor.com/ -o /tmp/meteor/inst && sed -e "s/^RELEASE=.
/RELEASE="$METEOR_VERSION"/" /tmp/meteor/inst > /tmp/meteor/inst-canonical && echo $METEOR_INSTALLER_SHA256 /tmp/meteor/inst-canonical | sha256sum -c && patch /tmp/meteor/inst /tmp/meteor/meteor-installer.patch && chmod +x /tmp/meteor/inst && /tmp/meteor/inst && rm -rf /tmp/meteor' returned a non-zero code: 1

Meteor app Flutterbum will not work

I am trying to do development with https://github.com/mcknightg/flutterbum by running Meteor from the container and getting the following error (but only when I run meteor from the container, with regular installation of Meteor it works fine):

Error: Error invoking Method 'addCustomer':
Method not found [404]

The method is defined in the email.js file, in the server sub-directory using Meteor.Methods. None of the defined Meteor.Methods is accessible from the client by Meteor.call. I modified the code and copied all Meteor.Method definitions into a .js file and put in the root folder into an "isServer" if-condition. This way all methods are accessible.

As stated before I do not have this issue when I run the app from the local Meteor server, only when I run it from the docker container. It seems to me as if the "server" sub-directory is not accessible from the container.

Can you please advise?

Spiderable support

Hi and thank you for such a great image - saves a lot of time.

However, as for me, it definitely missing spiderable package support - means useless in production. Fix is easy, only PhantomJS should be installed in the image.

volumeinvalidmode

hi, i know there is a prob between host and VM but how can i fix it ?
ฮป docker run --cap-add SYS_ADMIN -it --rm -p 3000:3000 -v C:\Users\sofiane\copyD\projets\docker:/app danieldent/meteor vboxsf-shim meteor docker: Error response from daemon: Invalid bind mount spec "C:\\Users\\sofiane\\copyD\\projets\\docker:/app": volumeinvalidmode: invalid mode: "/app". See 'docker run --help'.

library/meteor not found

Hi,

I pulled your image and ran docker build successfully.
When I issue docker run though, including all the parameter you specified, I get this error:

Unable to find image 'meteor:latest' locally
Pulling repository docker.io/library/meteor
docker: Error: image library/meteor not found.

I am running docker 1.11 on Ubuntu 14.04. Is this a bug or is it related to some local set-up?

Thank you,
Alex

Build fails with added mobile platforms

I have Meteor v1.3.4.1 and my build fails when I have IOS and Android platforms added, because it needs a server URL to build the mobile apps.
The meteor build command offers a --server-only option.

Docker signal handling issue during development mode

mfal noted: "Nice work! One thing: Stopping the meteor server (with CTR+C) leads to an infinite loop of server restarts. That's why I start the container in detached mode (-d and without --rm and -ti). Afterwards I use docker logs -f to see what's going on.

To shutdown or reload the container I use docker stop/restart ."

I responded: "Thanks for the feedback! I experienced the same frustration and I agree with you this is annoying. Your approach seems like a straightforward workaround. Using docker's kill command has been the workaround I've been using. I've been wanting to chat with the Docker folks about this. The signal handling doesn't feel quite right to me, I believe ctrl-c should be trapped and sent to the process, much how telnet & ssh behave. Docker's command line help indicates signal proxying is happening, but things are not behaving quite as I expect.".

My message to the docker mailing list has not yet received a response. This issue could use future follow-up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.