Skip to content
This repository was archived by the owner on Mar 8, 2024. It is now read-only.

Commit fb6d05b

Browse files
author
Dino Rodriguez
authored
fix: non-root user in Dockerfile (#496)
* fix: non-root user in Dockerfile * fix: add user * fix: change commands to work for alpine
1 parent ec22205 commit fb6d05b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ WORKDIR /opt/payid
1010

1111
COPY . .
1212

13+
# create a group and user
14+
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
15+
1316
# postgresql-client is needed if/when we run "wait-for-postgres.sh" (in ./scripts) to make sure Postgres is ready to execute SQL scripts.
1417
RUN apk --no-cache add postgresql-client~=12 &&\
1518
npm cache clean --force &&\
1619
npm install &&\
17-
npm run build &&\
18-
ls -al /opt/payid/build/ &&\
19-
ls -al /opt/payid/build/src
20+
npm run build
2021

2122
EXPOSE 8080 8081
2223

23-
CMD ["node", "/opt/payid/build/src/index.js"]
24+
# run all future commands as this user
25+
USER appuser
26+
27+
CMD ["node", "/opt/payid/build/src/index.js"]

0 commit comments

Comments
 (0)