Skip to content

Commit 64036d3

Browse files
committed
fix dockerfile
1 parent bdaee6b commit 64036d3

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

Dockerfile

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,29 @@
11
# build zokrates from source for local verify
22
FROM rust:1.53.0 as builder
3-
43
WORKDIR /app
54
COPY . .
65
RUN git clone --depth 1 --branch 0.8.8 https://github.com/Zokrates/ZoKrates /app/zoKratesv0.8.8
76
WORKDIR /app/zoKratesv0.8.8
87
RUN rustup install nightly-2022-06-28
98
RUN cargo +nightly-2022-06-28 build -p zokrates_cli --release
10-
119
# Copy the built result into /app/zoKrates
1210
RUN cp -r /app/zoKratesv0.8.8 /app/zoKrates
1311

14-
1512
FROM ubuntu:24.10
16-
1713
ENV USERNAME="app"
18-
1914
WORKDIR /app
20-
2115
# Install NodeJs
2216
RUN apt-get update && \
2317
apt-get install -y netcat-traditional curl && \
2418
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
25-
apt-get install -y nodejs gcc g++ make
26-
19+
apt-get install -y nodejs gcc g++ make && \
20+
mkdir /npm-cache
21+
# Setup environment variables
2722
ENV npm_config_cache=/npm-cache
2823
ENV ZOKRATES_HOME /app
2924
ENV ZOKRATES_STDLIBv8 /app/stdlibv8
3025
ENV ZOKRATES_STDLIB /app/stdlib
31-
26+
# Copy app files
3227
COPY config/default.js config/default.js
3328
COPY package.json package-lock.json ./
3429
COPY --from=builder /app/zoKratesv0.8.8/zokrates_stdlib/stdlib /app/stdlibv8
@@ -38,16 +33,13 @@ COPY --from=builder /app/zoKrates/target/release/zokrates /app/zokrates
3833
COPY src ./src
3934
COPY start-script ./start-script
4035
COPY start-dev ./start-dev
41-
36+
# Install npm packages as root
4237
RUN npm i
43-
44-
USER $USERNAME:$USERNAME
45-
46-
# Install NodeJs
38+
# Change/Add permission to user $USERNAME
4739
RUN groupadd --gid 10001 $USERNAME && \
4840
useradd --gid 10001 --uid 10001 --home /app --shell /bin/bash $USERNAME && \
49-
mkdir /npm-cache && \
5041
chown -R $USERNAME:$USERNAME /app /npm-cache
51-
42+
# Switch to user $USERNAME from root
43+
USER $USERNAME:$USERNAME
5244
EXPOSE 80
5345
CMD npm start

0 commit comments

Comments
 (0)