Skip to content

Commit

Permalink
fix: fix Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Nov 22, 2024
1 parent 13a26b6 commit c1012ef
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 22 deletions.
31 changes: 20 additions & 11 deletions nitro_enclave/amd64.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# base image
FROM --platform=amd64 rust:slim-bookworm AS builder
FROM --platform=linux/amd64 rust:slim-bookworm AS builder

RUN apt-get update \
&& apt-get install -y gcc g++ libc6-dev pkg-config libssl-dev

WORKDIR /src
COPY src ./src
COPY Cargo.toml Cargo.lock ./
RUN cargo build --release --locked -p ic_tee_nitro_gateway

FROM gcr.io/distroless/cc-debian12:debug AS runtime
&& apt-get install -y gcc g++ libc6-dev pkg-config libssl-dev wget

# working directory
WORKDIR /app
Expand All @@ -30,15 +23,31 @@ RUN chmod +x vsock-to-ip
RUN wget -qO- https://github.com/AdguardTeam/dnsproxy/releases/download/v0.73.3/dnsproxy-linux-amd64-v0.73.3.tar.gz | tar xvz
RUN mv linux-amd64/dnsproxy ./ && chmod +x dnsproxy

WORKDIR /build
COPY src ./src
COPY Cargo.toml Cargo.lock ./
RUN cargo build --release --locked -p ic_tee_nitro_gateway

FROM --platform=linux/amd64 debian:bookworm-slim AS runtime

# install dependency tools
RUN apt-get update \
&& apt-get install -y net-tools iptables iproute2 ca-certificates tzdata openssl \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /app /app/
# working directory
WORKDIR /app

# supervisord config
COPY nitro_enclave/supervisord.conf /etc/supervisord.conf

# setup.sh script that will act as entrypoint
COPY nitro_enclave/setup.sh ./
RUN chmod +x setup.sh

# your custom setup goes here
COPY --from=builder /src/target/release/ic_tee_nitro_gateway ./ic_tee_nitro_gateway
COPY --from=builder /build/target/release/ic_tee_nitro_gateway ./ic_tee_nitro_gateway

# entry point
ENTRYPOINT [ "/app/setup.sh" ]
31 changes: 20 additions & 11 deletions nitro_enclave/arm64.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# base image
FROM --platform=linux/amd64 rust:slim-bookworm AS builder
FROM --platform=linux/arm64 rust:slim-bookworm AS builder

RUN apt-get update \
&& apt-get install -y gcc g++ libc6-dev pkg-config libssl-dev

WORKDIR /src
COPY src ./src
COPY Cargo.toml Cargo.lock ./
RUN cargo build --release --locked -p ic_tee_nitro_gateway

FROM --platform=linux/amd64 gcr.io/distroless/cc-debian12:debug AS runtime
&& apt-get install -y gcc g++ libc6-dev pkg-config libssl-dev wget

# working directory
WORKDIR /app
Expand All @@ -30,15 +23,31 @@ RUN chmod +x vsock-to-ip
RUN wget -qO- https://github.com/AdguardTeam/dnsproxy/releases/download/v0.73.3/dnsproxy-linux-arm64-v0.73.3.tar.gz | tar xvz
RUN mv linux-arm64/dnsproxy ./ && chmod +x dnsproxy

WORKDIR /build
COPY src ./src
COPY Cargo.toml Cargo.lock ./
RUN cargo build --release --locked -p ic_tee_nitro_gateway

FROM --platform=linux/arm64 debian:bookworm-slim AS runtime

# install dependency tools
RUN apt-get update \
&& apt-get install -y net-tools iptables iproute2 ca-certificates tzdata openssl \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /app /app/
# working directory
WORKDIR /app

# supervisord config
COPY nitro_enclave/supervisord.conf /etc/supervisord.conf

# setup.sh script that will act as entrypoint
COPY nitro_enclave/setup.sh ./
RUN chmod +x setup.sh

# your custom setup goes here
COPY --from=builder /src/target/release/ic_tee_nitro_gateway ./ic_tee_nitro_gateway
COPY --from=builder /build/target/release/ic_tee_nitro_gateway ./ic_tee_nitro_gateway

# entry point
ENTRYPOINT [ "/app/setup.sh" ]

0 comments on commit c1012ef

Please sign in to comment.