Skip to content

Instantly share code, notes, and snippets.

@keidrun
Created May 18, 2019 06:29
Show Gist options
  • Save keidrun/e43a6a6d7c1d5641feff7ed0175f2c56 to your computer and use it in GitHub Desktop.
Save keidrun/e43a6a6d7c1d5641feff7ed0175f2c56 to your computer and use it in GitHub Desktop.
How to change permission for node user on a dockerized NodeJS app
FROM node:12.2-alpine
ENV NODE_ENV=production
WORKDIR /node
COPY package.json yarn.lock ./
RUN mkdir app && chown -R node:node .
USER node
RUN yarn install && yarn cache clean --force
WORKDIR /node/app
COPY --chown=node:node . .
EXPOSE 3000
CMD ["node", "app.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment