Skip to content

Commit 338b885

Browse files
committed
change the root user of the docker image
1 parent 55c2966 commit 338b885

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ RUN cargo +nightly-2022-06-28 build -p zokrates_cli --release
1717
FROM ubuntu:24.10
1818
WORKDIR /app
1919

20+
ENV USERNAME="app"
21+
2022
COPY config/default.js config/default.js
2123
COPY package.json package-lock.json ./
2224
COPY --from=builder /app/zoKratesv0.7.12/zokrates_stdlib/stdlib /app/stdlibv7
@@ -37,6 +39,14 @@ ENV ZOKRATES_STDLIB /app/stdlib
3739

3840
RUN npm i
3941

42+
# Change to User defined in base image
43+
RUN addgroup --gid 10001 $USERNAME && \
44+
adduser --gid 10001 --uid 10001 --home /app $USERNAME
45+
RUN chown -R $USERNAME:$USERNAME /app
46+
RUN mkdir /npm-cache
47+
RUN chown -R $USERNAME:$USERNAME /npm-cache
48+
ENV npm_config_cache=/npm-cache
49+
4050
USER $USERNAME:$USERNAME
4151
EXPOSE 80
4252
CMD npm start

0 commit comments

Comments
 (0)