-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
72 lines (53 loc) · 2.27 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
# The tag here should match the Meteor version of your app, per .meteor/release
FROM sozialhelden/meteor-base:1.4.4.2-new-ca-certs
RUN apt-get -yqq update \
&& DEBIAN_FRONTEND=noninteractive apt-get -yqq install \
ca-certificates \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy app package.json and package-lock.json into container
COPY ./app/package*.json $APP_SOURCE_FOLDER/
RUN bash $SCRIPTS_FOLDER/build-app-npm-dependencies.sh
# Copy app source into container
COPY ./app $APP_SOURCE_FOLDER/
ENV TOOL_NODE_FLAGS "--max-old-space-size=4096 --optimize_for_size --gc-interval=100"
ENV METEOR_DISABLE_OPTIMISTIC_CACHING "1"
ENV NODE_TLS_REJECT_UNAUTHORIZED "0"
RUN bash $SCRIPTS_FOLDER/build-meteor-bundle.sh
# Use the specific version of Node expected by your Meteor release, per https://docs.meteor.com/changelog.html; this is expected for Meteor 1.10.2
FROM node:4.8.2-slim
ENV APP_BUNDLE_FOLDER /opt/bundle
ENV SCRIPTS_FOLDER /docker
RUN apt-get -yqq update \
&& DEBIAN_FRONTEND=noninteractive apt-get -yqq install \
curl \
g++ \
make \
python \
ca-certificates \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy in entrypoint
COPY --from=0 $SCRIPTS_FOLDER $SCRIPTS_FOLDER/
# Copy in app bundle
COPY --from=0 $APP_BUNDLE_FOLDER/bundle $APP_BUNDLE_FOLDER/bundle/
ENV NODE_TLS_REJECT_UNAUTHORIZED "0"
RUN bash $SCRIPTS_FOLDER/build-meteor-npm-dependencies.sh --build-from-source
# Start another Docker stage, so that the final image doesn’t contain the layer with the build dependencies
# See previous FROM line; this must match
FROM node:4.8.2-slim
ENV APP_BUNDLE_FOLDER /opt/bundle
ENV SCRIPTS_FOLDER /docker
# Install OS runtime dependencies
RUN apt-get -yqq update \
&& DEBIAN_FRONTEND=noninteractive apt-get -yqq install \
curl \
bash \
ca-certificates \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy in entrypoint with the built and installed dependencies from the previous image
COPY --from=1 $SCRIPTS_FOLDER $SCRIPTS_FOLDER/
# Copy in app bundle with the built and installed dependencies from the previous image
COPY --from=1 $APP_BUNDLE_FOLDER/bundle $APP_BUNDLE_FOLDER/bundle/
ENV NODE_TLS_REJECT_UNAUTHORIZED "0"
# Start app
ENTRYPOINT ["/docker/entrypoint.sh"]
CMD ["node", "main.js"]