Dont run as root in docker

This commit is contained in:
LordMathis 2019-11-17 15:07:15 +01:00
parent 1d3840ba0b
commit c2747bc489
No known key found for this signature in database
GPG Key ID: 575849FD91CE470C
1 changed files with 5 additions and 3 deletions

View File

@ -9,10 +9,12 @@ RUN yarn build
# Stage 2 - run # Stage 2 - run
FROM node:12-alpine FROM node:12-alpine
WORKDIR /app WORKDIR /app
COPY --from=build-deps /usr/src/app/build /app/build COPY --chown=node:node --from=build-deps /usr/src/app/build /app/build
COPY --from=build-deps /usr/src/app/public /app/public COPY --chown=node:node --from=build-deps /usr/src/app/public /app/public
COPY --from=build-deps /usr/src/app/node_modules /app/node_modules COPY --chown=node:node --from=build-deps /usr/src/app/node_modules /app/node_modules
VOLUME /app/config VOLUME /app/config
VOLUME /app/content VOLUME /app/content
RUN chown node:node /app
USER node
EXPOSE 3000 EXPOSE 3000
CMD [ "node", "build/server.js" ] CMD [ "node", "build/server.js" ]