Skip to content

Commit 19968b2

Browse files
Merge pull request #731 from PierreBrisorgueil/dockerUser
feat(docker): review user to do nothing in root ✨
2 parents 1030daa + 6ec0a82 commit 19968b2

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Dockerfile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
FROM node:lts-slim
22

3-
# Create app directory
4-
WORKDIR /usr/src/app
3+
# switch user
4+
USER node
55

6-
# Install app dependencies
7-
COPY package*.json ./
8-
RUN npm install
6+
# Create app directory
7+
WORKDIR /home/node
98

10-
# Bundle app source
11-
COPY . .
9+
# Install app dependencies & setup
10+
COPY --chown=node:node package*.json ./
11+
RUN npm install --production
12+
COPY --chown=node:node . .
1213

1314
# Expose
1415
EXPOSE 80 443 3000 35729 8080
1516

16-
# Command to run the executable
17+
# Command to run
1718
CMD [ "node", "server.js" ]

0 commit comments

Comments
 (0)