Skip to content

Commit

Permalink
chore(ci): add non root user
Browse files Browse the repository at this point in the history
  • Loading branch information
0xawaz committed Nov 5, 2024
1 parent 975d77f commit 273ce8c
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions fhevm-engine/coprocessor/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
# Stage 1: Build
FROM rust:1.80.1-bullseye AS build
FROM rust:1.82.0-bullseye AS build

WORKDIR /app

# Install dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends protobuf-compiler && \
rm -rf /var/lib/apt/lists/*

# Copy necessary files
WORKDIR /app
COPY fhevm-engine/coprocessor /app/fhevm-engine/coprocessor
COPY fhevm-engine/Cargo.toml /app/fhevm-engine/
COPY fhevm-engine/Cargo.lock /app/fhevm-engine/
COPY ./fhevm-engine/ ./fhevm-engine/

WORKDIR /app/fhevm-engine/coprocessor

# Build with SQLX offline flag
RUN cargo fetch
RUN SQLX_OFFLINE=true cargo build --release

# Stage 2: Final image
FROM debian:bullseye-slim

# Copy the built binary
COPY --from=build /app/fhevm-engine/target/release/coprocessor /usr/local/bin
RUN useradd -m zama

COPY --from=build /app/fhevm-engine/coprocessor/target/release/coprocessor /usr/local/bin

RUN chown zama:zama /usr/local/bin/coprocessor && \
chmod 500 /usr/local/bin/coprocessor

USER zama

# Entrypoint
ENTRYPOINT ["/usr/local/bin/coprocessor"]

0 comments on commit 273ce8c

Please sign in to comment.