From cb0314177194ba1b889066d0cdea7ce31d8acc2a Mon Sep 17 00:00:00 2001 From: Mitch Gildenberg Date: Wed, 28 Jun 2023 17:42:37 +0000 Subject: [PATCH] example fixupes --- .../01_basic_oracle/sgx-function/Dockerfile | 17 +++++++++++++---- .../01_basic_oracle/sgx-function/Dockerfile.dev | 5 +++-- examples/functions/01_basic_oracle/src/lib.rs | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/examples/functions/01_basic_oracle/sgx-function/Dockerfile b/examples/functions/01_basic_oracle/sgx-function/Dockerfile index 46524ec10..4f0a96db5 100644 --- a/examples/functions/01_basic_oracle/sgx-function/Dockerfile +++ b/examples/functions/01_basic_oracle/sgx-function/Dockerfile @@ -13,15 +13,24 @@ WORKDIR /home/root/switchboard-function/sgx-function # cargo strip && \ # mv /home/root/switchboard-function/sgx-function/target/release/${CARGO_NAME} /sgx -RUN cargo build --release && \ +RUN --mount=type=cache,target=/usr/local/cargo/registry --mount=type=cache,target=/home/root/switchboard-function/sgx-function/target \ + cargo build --release && \ cargo strip && \ - mv /home/root/switchboard-function/sgx-function/target/release/${CARGO_NAME} /sgx + mv target/release/basic-oracle-function /sgx/app FROM switchboardlabs/sgx-function # Copy the binary WORKDIR /sgx -COPY --from=builder /sgx/${CARGO_NAME} /sgx/app +COPY --from=builder /sgx/app /sgx # Get the measurement from the enclave -RUN /get_measurement.sh \ No newline at end of file +RUN /get_measurement.sh + +# COPY configs/app.manifest.template . +# COPY configs/boot.sh /boot.sh +RUN gramine-manifest /app.manifest.template > app.manifest +# RUN gramine-sgx-gen-private-key +RUN gramine-sgx-sign --manifest app.manifest --output app.manifest.sgx | tail -2 | tee /measurement.txt + +ENTRYPOINT ["bash", "/boot.sh"] diff --git a/examples/functions/01_basic_oracle/sgx-function/Dockerfile.dev b/examples/functions/01_basic_oracle/sgx-function/Dockerfile.dev index c566a6773..f9dfa814e 100644 --- a/examples/functions/01_basic_oracle/sgx-function/Dockerfile.dev +++ b/examples/functions/01_basic_oracle/sgx-function/Dockerfile.dev @@ -8,7 +8,7 @@ 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/ @@ -40,4 +40,5 @@ WORKDIR /sgx COPY --from=builder /sgx/${CARGO_NAME} /sgx/app # Get the measurement from the enclave -RUN /get_measurement.sh \ No newline at end of file +RUN /get_measurement.sh +ENTRYPOINT ["bash", "/boot.sh"] diff --git a/examples/functions/01_basic_oracle/src/lib.rs b/examples/functions/01_basic_oracle/src/lib.rs index 70fdec19b..a779d79d3 100644 --- a/examples/functions/01_basic_oracle/src/lib.rs +++ b/examples/functions/01_basic_oracle/src/lib.rs @@ -12,7 +12,7 @@ pub use utils::*; pub mod actions; pub use actions::*; -declare_id!("HgVykECRLmtSfquJz7NTBg5H8SfL2ehTFZnzfDJQuxt2"); +declare_id!("6tdxUefBQRpL1CbJhzXgcMtWChKqXj9P9Rz2bvTWiiar"); pub const PROGRAM_SEED: &[u8] = b"BASICORACLE";