Skip to content

Commit

Permalink
docker: replace chown with read/execute permissions
Browse files Browse the repository at this point in the history
Co-authored-by: Kaspar Emanuel <[email protected]>
  • Loading branch information
AbdulrhmnGhanem and kasbah committed Oct 27, 2022
1 parent 84d03ee commit f49d18d
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,20 @@ COPY yarn.lock .
RUN yarn --frozen-lockfile

FROM base AS production

ENV NODE_ENV=production
# Make files are readable execuatable bu the `node` user.
ARG PERMISSION=0555
COPY --chmod=${PERMISSION} --from=build /deps/node_modules/ node_modules/
COPY --chmod=${PERMISSION} package.json .
COPY --chmod=${PERMISSION} next.config.js .
COPY --chmod=${PERMISSION} public/ public/
COPY --chmod=${PERMISSION} src/server.js server.js

# The `.next` directory is used by `next/image` to cache optimized images.
# So it needs to be owned by the `node` user.
COPY --chown=node:node --from=build /build/.next/ .next/
COPY --chown=node:node --from=build /deps/node_modules/ node_modules/
COPY --chown=node:node package.json .
COPY --chown=node:node next.config.js .
COPY --chown=node:node public/ public/
RUN mkdir src/ && chown -R node src
COPY --chown=node:node src/server.js src/server.js
ENV NODE_ENV=productionu

USER node

CMD ["node", "src/server.js"]
CMD ["node", "server.js"]

0 comments on commit f49d18d

Please sign in to comment.