This repository has been archived by the owner on Dec 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Dockerfile
52 lines (34 loc) · 1.68 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
FROM reactioncommerce/meteor:1.10.2-v1 as builder
ENV APP_SOURCE_DIR /usr/local/src/appsrc
ENV APP_BUNDLE_DIR /usr/local/src/build
ENV TOOL_NODE_FLAGS --max-old-space-size=4096
USER root
RUN mkdir -p "$APP_SOURCE_DIR" \
&& mkdir -p "$APP_BUNDLE_DIR" \
&& chown -R node "$APP_SOURCE_DIR" \
&& chown -R node "$APP_BUNDLE_DIR"
COPY --chown=node . $APP_SOURCE_DIR
WORKDIR $APP_SOURCE_DIR
USER node
RUN npm install --no-audit
RUN printf "\\n[-] Building Meteor application...\\n" \
&& /home/node/.meteor/meteor build --server-only --architecture os.linux.x86_64 --directory "$APP_BUNDLE_DIR"
##############################################################################
# final build stage - create the final production image
##############################################################################
FROM node:12.16.1-slim
LABEL maintainer="Reaction Commerce <[email protected]>"
# grab the dependencies and built app from the previous temporary builder image
COPY --chown=node --from=builder /usr/local/src/build/bundle /usr/local/src/app
# copy the waitForMongo script, too
COPY --chown=node --from=builder /usr/local/src/appsrc/.reaction/waitForMongo.js /usr/local/src/app/programs/server/waitForMongo.js
# Install the latest version of NPM (as of when this
# base image is built)
RUN npm i -g npm@latest
WORKDIR /usr/local/src/app/programs/server/
RUN npm install --production --no-audit
# Also install mongodb pkg needed by the waitForMongo script
RUN npm install -E --no-save [email protected]
WORKDIR /usr/local/src/app
ENV PATH $PATH:/usr/local/src/app/programs/server/node_modules/.bin
CMD ["sh", "-c", "cd programs/server && node waitForMongo.js && cd ../.. && node main.js"]