1+ # base image
2+ FROM --platform=arm64 rust:slim-bookworm AS builder
3+
4+ RUN apt-get update \
5+ && apt-get install -y gcc g++ libc6-dev pkg-config libssl-dev
6+
7+ WORKDIR /src
8+ COPY src ./src
9+ COPY examples ./examples
10+ COPY Cargo.toml Cargo.lock .env ./
11+ RUN cargo build --release --locked -p idempotent-proxy-server
12+
13+ FROM debian:bookworm-slim AS runtime
14+
15+ # install dependency tools
16+ RUN apt-get update \
17+ && apt-get install -y net-tools iptables iproute2 wget ca-certificates tzdata curl openssl \
18+ && update-ca-certificates \
19+ && rm -rf /var/lib/apt/lists/*
20+
21+ # working directory
22+ WORKDIR /app
23+
24+ # supervisord to manage programs
25+ RUN wget -O supervisord http://public.artifacts.marlin.pro/projects/enclaves/supervisord_master_linux_amd64
26+ RUN chmod +x supervisord
27+
28+ # transparent proxy component inside the enclave to enable outgoing connections
29+ RUN wget -O ip-to-vsock-transparent http://public.artifacts.marlin.pro/projects/enclaves/ip-to-vsock-transparent_v1.0.0_linux_amd64
30+ RUN chmod +x ip-to-vsock-transparent
31+
32+ # key generator to generate static keys
33+ RUN wget -O keygen http://public.artifacts.marlin.pro/projects/enclaves/keygen_v1.0.0_linux_amd64
34+ RUN chmod +x keygen
35+
36+ # attestation server inside the enclave that generates attestations
37+ RUN wget -O attestation-server http://public.artifacts.marlin.pro/projects/enclaves/attestation-server_v1.0.0_linux_amd64
38+ RUN chmod +x attestation-server
39+
40+ # proxy to expose attestation server outside the enclave
41+ RUN wget -O vsock-to-ip http://public.artifacts.marlin.pro/projects/enclaves/vsock-to-ip_v1.0.0_linux_amd64
42+ RUN chmod +x vsock-to-ip
43+
44+ # dnsproxy to provide DNS services inside the enclave
45+ RUN wget -O dnsproxy http://public.artifacts.marlin.pro/projects/enclaves/dnsproxy_v0.46.5_linux_amd64
46+ RUN chmod +x dnsproxy
47+
48+ # supervisord config
49+ COPY enclave/supervisord.conf /etc/supervisord.conf
50+
51+ # setup.sh script that will act as entrypoint
52+ COPY enclave/setup.sh ./
53+ RUN chmod +x setup.sh
54+
55+ # your custom setup goes here
56+ COPY --from=builder /src/.env ./.env
57+ COPY --from=builder /src/target/release/idempotent-proxy-server ./idempotent-proxy-server
58+
59+ # entry point
60+ ENTRYPOINT [ "/app/setup.sh" ]
0 commit comments