Files
cgm-remote-monitor/Dockerfile
T
Lennart Goedhart 5e0e592949 Fixes broken Docker image build
The `npm audit fix` in the `Dockerfile` is currently
deleting vulnerable packages. Although we do want to have package
security, this should be done in a development process, not as part
of the Docker build.

This commit also reduces the Docker image size and improves security.
2021-12-06 17:56:04 +11:00

24 lines
745 B
Docker

FROM node:14.15.3-alpine
LABEL maintainer="Nightscout Contributors"
WORKDIR /opt/app
ADD . /opt/app
# TODO: We should be able to do `RUN npm install --only=production`.
# For this to work, we need to copy only package.json and things needed for `npm`'s to succeed.
# TODO: Do we need to re-add `npm audit fix`? Or should that be part of a development process/stage?
RUN npm install --cache /tmp/empty-cache && \
npm run postinstall && \
npm run env && \
rm -rf /tmp/*
# TODO: These should be added in the future to correctly cache express-minify content to disk
# Currently, doing this breaks the browser cache.
# mkdir /tmp/public && \
# chown node:node /tmp/public
USER node
EXPOSE 1337
CMD ["node", "lib/server/server.js"]