|
1 |
| -# A base Docker image for Meteor applications. https://hub.docker.com/r/jshimko/meteor-launchpad/ |
2 |
| -FROM abernix/meteord:onbuild |
3 |
| -# the version (that bit after :) is dependent somehow on meteor versions. it used to be 1.1.1 but now as we go for Meteor 1.8, let's use latest. |
4 |
| -# If you get in trouble with starting Meteor, this might be something to look at |
5 |
| -MAINTAINER apinf <info@apinf.io> |
| 1 | +FROM debian:jessie |
| 2 | +MAINTAINER APInf info@apinf.io |
| 3 | + |
| 4 | +RUN groupadd -r node && useradd -m -g node node |
| 5 | + |
| 6 | +# Gosu |
| 7 | +ENV GOSU_VERSION 1.10 |
| 8 | + |
| 9 | +# MongoDB |
| 10 | +ENV MONGO_VERSION 3.4.10 |
| 11 | +ENV MONGO_MAJOR 3.4 |
| 12 | +ENV MONGO_PACKAGE mongodb-org |
| 13 | + |
| 14 | +# PhantomJS |
| 15 | +ENV PHANTOM_VERSION 2.1.1 |
| 16 | + |
| 17 | +# build directories |
| 18 | +ENV APP_SOURCE_DIR /opt/meteor/src |
| 19 | +ENV APP_BUNDLE_DIR /opt/meteor/dist |
| 20 | +ENV BUILD_SCRIPTS_DIR /opt/build_scripts |
| 21 | + |
| 22 | +# Add entrypoint and build scripts |
| 23 | +COPY scripts $BUILD_SCRIPTS_DIR |
| 24 | +RUN chmod -R 750 $BUILD_SCRIPTS_DIR |
| 25 | + |
| 26 | +# Define all --build-arg options |
| 27 | +ONBUILD ARG APT_GET_INSTALL |
| 28 | +ONBUILD ENV APT_GET_INSTALL $APT_GET_INSTALL |
| 29 | + |
| 30 | +ONBUILD ARG NODE_VERSION |
| 31 | +ONBUILD ENV NODE_VERSION ${NODE_VERSION:-8.9.0} |
| 32 | + |
| 33 | +ONBUILD ARG NPM_TOKEN |
| 34 | +ONBUILD ENV NPM_TOKEN $NPM_TOKEN |
| 35 | + |
| 36 | +ONBUILD ARG INSTALL_MONGO |
| 37 | +ONBUILD ENV INSTALL_MONGO $INSTALL_MONGO |
| 38 | + |
| 39 | +ONBUILD ARG INSTALL_PHANTOMJS |
| 40 | +ONBUILD ENV INSTALL_PHANTOMJS $INSTALL_PHANTOMJS |
| 41 | + |
| 42 | +ONBUILD ARG INSTALL_GRAPHICSMAGICK |
| 43 | +ONBUILD ENV INSTALL_GRAPHICSMAGICK $INSTALL_GRAPHICSMAGICK |
| 44 | + |
| 45 | +# Node flags for the Meteor build tool |
| 46 | +ONBUILD ARG TOOL_NODE_FLAGS |
| 47 | +ONBUILD ENV TOOL_NODE_FLAGS $TOOL_NODE_FLAGS |
| 48 | + |
| 49 | +# optionally custom apt dependencies at app build time |
| 50 | +ONBUILD RUN if [ "$APT_GET_INSTALL" ]; then apt-get update && apt-get install -y $APT_GET_INSTALL; fi |
| 51 | + |
| 52 | +# copy the app to the container |
| 53 | +ONBUILD COPY . $APP_SOURCE_DIR |
| 54 | + |
| 55 | +# install all dependencies, build app, clean up |
| 56 | +ONBUILD RUN cd $APP_SOURCE_DIR && \ |
| 57 | + $BUILD_SCRIPTS_DIR/install-deps.sh && \ |
| 58 | + $BUILD_SCRIPTS_DIR/install-node.sh && \ |
| 59 | + $BUILD_SCRIPTS_DIR/install-phantom.sh && \ |
| 60 | + $BUILD_SCRIPTS_DIR/install-graphicsmagick.sh && \ |
| 61 | + $BUILD_SCRIPTS_DIR/install-mongo.sh && \ |
| 62 | + $BUILD_SCRIPTS_DIR/install-meteor.sh && \ |
| 63 | + $BUILD_SCRIPTS_DIR/build-meteor.sh && \ |
| 64 | + $BUILD_SCRIPTS_DIR/post-build-cleanup.sh |
| 65 | + |
| 66 | +# Default values for Meteor environment variables |
| 67 | +ENV ROOT_URL http://localhost |
| 68 | +ENV MONGO_URL mongodb://127.0.0.1:27017/meteor |
| 69 | +ENV PORT 3000 |
| 70 | + |
| 71 | +EXPOSE 3000 |
| 72 | + |
| 73 | +WORKDIR $APP_BUNDLE_DIR/bundle |
| 74 | + |
| 75 | +# start the app |
| 76 | +ENTRYPOINT ["./entrypoint.sh"] |
| 77 | +CMD ["node", "main.js"] |
0 commit comments