forked from jshimko/meteor-launchpad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
80 lines (59 loc) · 2.05 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
FROM debian:jessie
MAINTAINER Jeremy Shimko <[email protected]>
RUN groupadd -r node && useradd -m -g node node
# Gosu
ENV GOSU_VERSION 1.10
# Meteor Build
ENV TOOL_NODE_FLAGS --max-old-space-size=8192
# MongoDB
ENV MONGO_VERSION 3.4.10
ENV MONGO_MAJOR 3.4
ENV MONGO_PACKAGE mongodb-org
# PhantomJS
ENV PHANTOM_VERSION 2.1.1
# build directories
ENV APP_SOURCE_DIR /opt/meteor/src
ENV APP_BUNDLE_DIR /opt/meteor/dist
ENV BUILD_SCRIPTS_DIR /opt/build_scripts
# Add entrypoint and build scripts
COPY scripts $BUILD_SCRIPTS_DIR
RUN chmod -R 750 $BUILD_SCRIPTS_DIR
# Define all --build-arg options
ONBUILD ARG APT_GET_INSTALL
ONBUILD ENV APT_GET_INSTALL $APT_GET_INSTALL
ONBUILD ARG NODE_VERSION
ONBUILD ENV NODE_VERSION ${NODE_VERSION:-8.12.0}
ONBUILD ARG NPM_TOKEN
ONBUILD ENV NPM_TOKEN $NPM_TOKEN
ONBUILD ARG INSTALL_MONGO
ONBUILD ENV INSTALL_MONGO $INSTALL_MONGO
ONBUILD ARG INSTALL_PHANTOMJS
ONBUILD ENV INSTALL_PHANTOMJS $INSTALL_PHANTOMJS
ONBUILD ARG INSTALL_GRAPHICSMAGICK
ONBUILD ENV INSTALL_GRAPHICSMAGICK $INSTALL_GRAPHICSMAGICK
# Node flags for the Meteor build tool
ONBUILD ARG TOOL_NODE_FLAGS
ONBUILD ENV TOOL_NODE_FLAGS --max-old-space-size=8192
# optionally custom apt dependencies at app build time
ONBUILD RUN if [ "$APT_GET_INSTALL" ]; then apt-get update && apt-get install -y $APT_GET_INSTALL; fi
# copy the app to the container
ONBUILD COPY . $APP_SOURCE_DIR
# install all dependencies, build app, clean up
ONBUILD RUN cd $APP_SOURCE_DIR && \
$BUILD_SCRIPTS_DIR/install-deps.sh && \
$BUILD_SCRIPTS_DIR/install-node.sh && \
$BUILD_SCRIPTS_DIR/install-phantom.sh && \
$BUILD_SCRIPTS_DIR/install-graphicsmagick.sh && \
$BUILD_SCRIPTS_DIR/install-mongo.sh && \
$BUILD_SCRIPTS_DIR/install-meteor.sh && \
$BUILD_SCRIPTS_DIR/build-meteor.sh && \
$BUILD_SCRIPTS_DIR/post-build-cleanup.sh
# Default values for Meteor environment variables
ENV ROOT_URL http://localhost
ENV MONGO_URL mongodb://127.0.0.1:27017/meteor
ENV PORT 3000
EXPOSE 3000
WORKDIR $APP_BUNDLE_DIR/bundle
# start the app
ENTRYPOINT ["./entrypoint.sh"]
CMD ["node", "main.js"]