2020-07-02 11:51:38 -04:00
|
|
|
# the base image is suitable for running web with /app bind mounted
|
2021-01-05 14:30:02 -05:00
|
|
|
FROM node:10.23.1 as base
|
2019-02-19 09:51:34 -05:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2020-02-12 07:54:45 -05:00
|
|
|
# install_deps changes app files and installs npm packages
|
|
|
|
# as such it has to run at a later stage
|
|
|
|
|
2020-05-22 06:34:57 -04:00
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install -y parallel \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2021-02-18 06:47:07 -05:00
|
|
|
RUN mkdir /app/node_modules && chown node:node /app/node_modules
|
2020-07-02 11:51:38 -04:00
|
|
|
|
|
|
|
# the deps image is used for caching npm ci
|
2020-05-22 06:34:57 -04:00
|
|
|
FROM base as deps
|
2020-02-12 07:54:45 -05:00
|
|
|
|
2019-08-02 04:47:45 -04:00
|
|
|
COPY package.json package-lock.json /app/
|
2019-02-19 09:51:34 -05:00
|
|
|
|
2020-05-22 06:34:57 -04:00
|
|
|
RUN npm ci --quiet
|
|
|
|
|
2019-02-19 09:51:34 -05:00
|
|
|
|
2020-07-02 11:51:38 -04:00
|
|
|
# the dev is suitable for running tests
|
|
|
|
FROM deps as dev
|
2020-02-12 10:37:32 -05:00
|
|
|
|
2020-07-02 11:51:38 -04:00
|
|
|
COPY . /app
|
2020-02-12 10:37:32 -05:00
|
|
|
|
|
|
|
RUN mkdir -p /app/data/dumpFolder && \
|
|
|
|
mkdir -p /app/data/logs && \
|
|
|
|
mkdir -p /app/data/pdf && \
|
|
|
|
mkdir -p /app/data/uploads && \
|
|
|
|
mkdir -p /app/data/zippedProjects && \
|
|
|
|
chmod -R 0755 /app/data/ && \
|
|
|
|
chown -R node:node /app/data/
|
|
|
|
|
2020-07-02 11:51:38 -04:00
|
|
|
ARG SENTRY_RELEASE
|
|
|
|
ENV SENTRY_RELEASE=$SENTRY_RELEASE
|
|
|
|
|
2019-02-19 09:51:34 -05:00
|
|
|
USER node
|
|
|
|
|
2020-06-23 09:15:49 -04:00
|
|
|
|
2020-07-02 11:51:38 -04:00
|
|
|
# the webpack image has deps+src+webpack artifacts
|
|
|
|
FROM dev as webpack
|
|
|
|
|
|
|
|
USER root
|
|
|
|
RUN chmod 0755 ./install_deps.sh && ./install_deps.sh
|
|
|
|
|
|
|
|
|
|
|
|
# the final production image without webpack source maps
|
|
|
|
FROM webpack as app
|
|
|
|
|
|
|
|
RUN find /app/public -name '*.js.map' -delete
|
|
|
|
USER node
|
|
|
|
|
|
|
|
CMD ["node", "--expose-gc", "app.js"]
|