-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
59 lines (45 loc) · 1.41 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Use Ubuntu as the base image
FROM rust:1.80 as builder
# Avoid prompts from apt
# ENV DEBIAN_FRONTEND=noninteractive
# Set the working directory in the container
WORKDIR /usr/src/app
# Install system dependencies including OpenSSL dev libraries
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
libssl-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Set OpenSSL directory and other environment variables
ENV OPENSSL_DIR=/usr/lib/ssl \
OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu \
OPENSSL_INCLUDE_DIR=/usr/include/openssl
# Install Foundry
RUN curl -L https://foundry.paradigm.xyz | bash
ENV PATH="/root/.foundry/bin:${PATH}"
# Ensure Foundry is installed correctly
RUN foundryup
# Verify Foundry installation
RUN forge --version
# Install cargo-risczero
RUN cargo install cargo-binstall
RUN cargo binstall cargo-risczero -y
RUN cargo risczero install
# Copy the Cargo.toml and Cargo.lock files
COPY Cargo.toml Cargo.lock ./
# Copy the entire project
COPY . .
# Build the application
RUN cargo build --release
# Start a new stage for a smaller final image
FROM debian:buster-slim
# Install necessary runtime libraries
RUN apt-get update && apt-get install -y \
libssl1.1 \
&& rm -rf /var/lib/apt/lists/*
# Copy the binary from the builder stage
COPY --from=builder /usr/src/app/target/release/server /usr/local/bin/server
# Set the startup command
CMD ["server"]