overleaf/services/web/Dockerfile
Jakob Ackermann 8789296f5a Merge pull request #6481 from overleaf/jpa-node-14-18-3
[misc] upgrade node version from 14.18.1 to 14.18.3

GitOrigin-RevId: 976542fcc0271e323695c59a987dcf1614ee633e
2022-01-28 09:03:53 +00:00

55 lines
1.5 KiB
Docker

# the base image is suitable for running web with /overleaf/services/web bind
# mounted
FROM node:14.18.3 as base
WORKDIR /overleaf/services/web
# install_deps changes app files and installs npm packages
# as such it has to run at a later stage
RUN mkdir /overleaf/services/web/node_modules \
&& chown node:node /overleaf/services/web/node_modules
# the deps image is used for caching npm ci
FROM base as deps
COPY services/web/package.json services/web/package-lock.json /overleaf/services/web/
RUN npm ci --quiet
# the dev is suitable for running tests
FROM deps as dev
COPY services/web /overleaf/services/web
RUN mkdir -p /overleaf/services/web/data/dumpFolder \
&& mkdir -p /overleaf/services/web/data/logs \
&& mkdir -p /overleaf/services/web/data/pdf \
&& mkdir -p /overleaf/services/web/data/uploads \
&& mkdir -p /overleaf/services/web/data/zippedProjects \
&& mkdir -p /overleaf/services/web/data/projectHistories \
&& chmod -R 0755 /overleaf/services/web/data \
&& chown -R node:node /overleaf/services/web/data
ARG SENTRY_RELEASE
ENV SENTRY_RELEASE=$SENTRY_RELEASE
USER node
# 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 /overleaf/services/web/public -name '*.js.map' -delete
RUN rm /overleaf/services/web/modules/server-ce-scripts -rf
USER node
CMD ["node", "--expose-gc", "app.js"]