Skip to content

Commit

Permalink
Backend: Change Dockerfile to improve security at the cost of getting…
Browse files Browse the repository at this point in the history
… a larger image size.
  • Loading branch information
winwiz1 committed Nov 14, 2020
1 parent 2db9530 commit e354420
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@ RUN apt-get update -qq && apt-get upgrade -qq \
/var/lib/log

WORKDIR /crisp-react/server
COPY --chown=node:node ./server/ .
COPY ./server/ .
RUN yarn
WORKDIR /crisp-react/client
COPY --chown=node:node ./client/ .
COPY ./client/ .
RUN yarn && yarn build:prod

FROM build as prod
WORKDIR /crisp-react/server
COPY --chown=node:node ./server/ .
COPY --from=build --chown=node:node /crisp-react/client/config/ /crisp-react/server/config/
COPY ./server/ .
COPY --from=build /crisp-react/client/config/ /crisp-react/server/config/
RUN yarn && yarn compile

COPY --from=build --chown=node:node /crisp-react/client/dist/ /crisp-react/server/build/client/static/
COPY --from=build /crisp-react/client/dist/ /crisp-react/server/build/client/static/
RUN find /crisp-react -type d -exec chmod 755 {} \;
RUN find /crisp-react -type f -exec chmod 644 {} \;

EXPOSE 3000
ENV NODE_ENV=production
Expand Down

0 comments on commit e354420

Please sign in to comment.