sbv2-solana/examples/functions/01_basic_oracle/sgx-function/Dockerfile.dev

43 lines
1.4 KiB
Docker

# syntax=docker/dockerfile:1.4
FROM switchboardlabs/sgx-function AS builder
ARG CARGO_NAME=switchboard-function
WORKDIR /home/root/solana-sdk
COPY ./rust/switchboard-solana/Cargo.toml \
./rust/switchboard-solana/Cargo.lock \
./rust/switchboard-solana/
COPY ./examples/functions/01_basic_oracle/Cargo.toml \
./examples/functions/01_basic_oracle/Cargo.lock \
./examples/functions/01_basic_oracle/
COPY ./examples/functions/01_basic_oracle/sgx-function/Cargo.toml \
./examples/functions/01_basic_oracle/sgx-function/Cargo.lock \
./examples/functions/01_basic_oracle/sgx-function/
COPY ./rust/switchboard-solana/src \
./rust/switchboard-solana/src/
COPY ./examples/functions/01_basic_oracle/src \
./examples/functions/01_basic_oracle/src/
COPY ./examples/functions/01_basic_oracle/sgx-function/src \
./examples/functions/01_basic_oracle/sgx-function/src/
WORKDIR /home/root/solana-sdk/examples/functions/01_basic_oracle/sgx-function
RUN --mount=type=cache,target=/usr/local/cargo/registry,id=${TARGETPLATFORM} --mount=type=cache,target=target,id=${TARGETPLATFORM} \
cargo build --release && \
cargo strip && \
mv /home/root/solana-sdk/examples/functions/01_basic_oracle/sgx-function/target/release/${CARGO_NAME} /sgx
FROM switchboardlabs/sgx-function
# Copy the binary
WORKDIR /sgx
COPY --from=builder /sgx/${CARGO_NAME} /sgx/app
# Get the measurement from the enclave
RUN /get_measurement.sh