From 3cfd038c9d0f05d9d5bce287069be7adb8c900c4 Mon Sep 17 00:00:00 2001 From: Kai Hendry Date: Mon, 10 Feb 2020 08:46:05 +0800 Subject: [PATCH] This comes from my unmerged PR (#897) https://github.com/unee-t/frontend/pull/750 which I think solves https://github.com/unee-t/frontend/pull/892#issuecomment-583220464 because it locks down to .meteor/release --- Dockerfile | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index e456dd4d..d757b7c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,36 @@ -FROM node:8 AS builder +FROM node:8.15.1 AS builder -RUN curl -sL https://install.meteor.com | sed s/--progress-bar/-sL/g | /bin/sh -RUN mkdir /src /bundle -RUN chown -R node /src /bundle +ENV BUNDLE_DIR /home/node/bundle +ENV SRC_DIR /home/node/src +ENV TMP_DIR /home/node/tmp USER node:node -WORKDIR /src -COPY --chown=node:node . . +RUN mkdir -p $SRC_DIR $BUNDLE_DIR $TMP_DIR +COPY --chown=node:node . $SRC_DIR -RUN meteor npm install -RUN meteor build --architecture os.linux.x86_64 --directory /bundle -RUN cd /bundle/bundle/programs/server && npm install +RUN curl -o $TMP_DIR/meteor.sh 'https://install.meteor.com?release=1.8.1'; sh $TMP_DIR/meteor.sh -FROM node:8-slim +ENV PATH="/home/node/.meteor:${PATH}" +WORKDIR $SRC_DIR +RUN npm i +RUN meteor npm install --production +RUN meteor build --server-only --directory $BUNDLE_DIR +RUN cd ${BUNDLE_DIR}/bundle/programs/server && npm install + +FROM node:8.15.1-slim + +ENV APP_DIR /home/node/app +ENV BUNDLE_DIR /home/node/bundle USER node:node -COPY --from=builder /bundle /app -WORKDIR /app/bundle +COPY --from=builder $BUNDLE_DIR $APP_DIR +WORKDIR $APP_DIR/bundle + ENV PORT 3000 EXPOSE 3000 + CMD ["node", "./main.js"]