2021-08-16 06:09:51 -07:00
|
|
|
#syntax=docker/dockerfile:1.2@sha256:e2a8561e419ab1ba6b2fe6cbdf49fd92b95912df1cf7d313c3e2230a333fdbcc
|
2022-07-22 06:01:41 -07:00
|
|
|
FROM ghcr.io/certusone/solana:1.10.31@sha256:d31e8db926a1d3fbaa9d9211d9979023692614b7b64912651aba0383e8c01bad AS solana
|
2020-08-20 09:56:26 -07:00
|
|
|
|
2022-02-28 12:48:50 -08:00
|
|
|
# Support additional root CAs
|
2022-07-14 10:29:33 -07:00
|
|
|
COPY cert.pem* /certs/
|
2022-02-28 12:48:50 -08:00
|
|
|
# Debian
|
|
|
|
RUN if [ -e /certs/cert.pem ]; then cp /certs/cert.pem /etc/ssl/certs/ca-certificates.crt; fi
|
|
|
|
|
2021-08-16 06:09:51 -07:00
|
|
|
# Add bridge contract sources
|
|
|
|
WORKDIR /usr/src/bridge
|
2020-08-20 09:56:26 -07:00
|
|
|
|
2022-07-05 13:40:42 -07:00
|
|
|
COPY . .
|
2022-04-13 03:50:06 -07:00
|
|
|
|
|
|
|
ENV RUST_LOG="solana_runtime::system_instruction_processor=trace,solana_runtime::message_processor=trace,solana_bpf_loader=debug,solana_rbpf=debug"
|
|
|
|
ENV RUST_BACKTRACE=1
|
|
|
|
|
|
|
|
FROM solana AS builder
|
|
|
|
|
2021-08-16 06:09:51 -07:00
|
|
|
RUN mkdir -p /opt/solana/deps
|
|
|
|
|
|
|
|
ENV EMITTER_ADDRESS="11111111111111111111111111111115"
|
2022-03-23 08:50:10 -07:00
|
|
|
ARG BRIDGE_ADDRESS
|
|
|
|
RUN [ -n "${BRIDGE_ADDRESS}" ]
|
2021-08-16 06:09:51 -07:00
|
|
|
|
2021-08-04 04:46:07 -07:00
|
|
|
# Build Wormhole Solana programs
|
2022-04-13 03:50:06 -07:00
|
|
|
RUN --mount=type=cache,target=target,id=build \
|
2022-07-14 10:29:33 -07:00
|
|
|
--mount=type=cache,target=/usr/local/cargo/registry,id=cargo_registry \
|
2022-02-18 03:48:10 -08:00
|
|
|
cargo build-bpf --manifest-path "bridge/program/Cargo.toml" -- --locked && \
|
|
|
|
cargo build-bpf --manifest-path "bridge/cpi_poster/Cargo.toml" -- --locked && \
|
|
|
|
cargo build-bpf --manifest-path "modules/token_bridge/program/Cargo.toml" -- --locked && \
|
|
|
|
cargo build-bpf --manifest-path "modules/nft_bridge/program/Cargo.toml" -- --locked && \
|
|
|
|
cargo build-bpf --manifest-path "migration/Cargo.toml" -- --locked && \
|
2022-04-08 02:48:33 -07:00
|
|
|
cp target/deploy/bridge.so /opt/solana/deps/bridge.so && \
|
|
|
|
cp target/deploy/cpi_poster.so /opt/solana/deps/cpi_poster.so && \
|
|
|
|
cp target/deploy/wormhole_migration.so /opt/solana/deps/wormhole_migration.so && \
|
|
|
|
cp target/deploy/token_bridge.so /opt/solana/deps/token_bridge.so && \
|
|
|
|
cp target/deploy/nft_bridge.so /opt/solana/deps/nft_bridge.so && \
|
2022-03-04 20:30:29 -08:00
|
|
|
cp modules/token_bridge/token-metadata/spl_token_metadata.so /opt/solana/deps/spl_token_metadata.so
|
2021-08-04 07:33:14 -07:00
|
|
|
|
2022-04-13 03:50:06 -07:00
|
|
|
# This stage is skipped in normal builds and needs to be explicitly invoked
|
|
|
|
# (like `DOCKER_BUILDKIT=1 docker build --target ci_tests .`).
|
|
|
|
FROM solana AS ci_tests
|
|
|
|
|
|
|
|
# This emitter address is necessary for the governance tests.
|
|
|
|
ENV EMITTER_ADDRESS="CiByUvEcx7w2HA4VHcPCBUAFQ73Won9kB36zW9VjirSr"
|
|
|
|
|
2022-04-18 23:44:42 -07:00
|
|
|
ARG BRIDGE_ADDRESS
|
|
|
|
RUN [ -n "${BRIDGE_ADDRESS}" ]
|
|
|
|
|
|
|
|
# This is a pre-built contract.
|
|
|
|
RUN --mount=type=cache,target=target,id=test \
|
2022-07-22 06:01:41 -07:00
|
|
|
--mount=type=cache,target=/usr/local/cargo/registry,id=cargo_registry \
|
2022-04-18 23:44:42 -07:00
|
|
|
mkdir -p target/deploy && \
|
|
|
|
cp modules/token_bridge/token-metadata/spl_token_metadata.so target/deploy/
|
|
|
|
|
2022-04-13 03:50:06 -07:00
|
|
|
RUN --mount=type=cache,target=target,id=test \
|
2022-07-22 06:01:41 -07:00
|
|
|
--mount=type=cache,target=/usr/local/cargo/registry,id=cargo_registry \
|
2022-04-13 03:50:06 -07:00
|
|
|
cargo test-bpf \
|
|
|
|
--manifest-path bridge/program/Cargo.toml \
|
|
|
|
--features trace,instructions
|
2022-03-23 08:50:10 -07:00
|
|
|
|
2022-04-18 23:44:42 -07:00
|
|
|
RUN --mount=type=cache,target=target,id=test \
|
2022-07-22 06:01:41 -07:00
|
|
|
--mount=type=cache,target=/usr/local/cargo/registry,id=cargo_registry \
|
2022-04-18 23:44:42 -07:00
|
|
|
cargo test-bpf \
|
2022-04-20 22:18:56 -07:00
|
|
|
--manifest-path modules/token_bridge/program/Cargo.toml \
|
|
|
|
--features trace,instructions
|
|
|
|
|
|
|
|
RUN --mount=type=cache,target=target,id=test \
|
2022-07-22 06:01:41 -07:00
|
|
|
--mount=type=cache,target=/usr/local/cargo/registry,id=cargo_registry \
|
2022-04-20 22:18:56 -07:00
|
|
|
cargo test-bpf \
|
|
|
|
--manifest-path modules/nft_bridge/program/Cargo.toml \
|
|
|
|
--features trace,instructions
|
2022-04-18 23:44:42 -07:00
|
|
|
|
2022-03-23 08:50:10 -07:00
|
|
|
FROM scratch AS export-stage
|
|
|
|
COPY --from=builder /opt/solana/deps /
|
2022-04-13 03:50:06 -07:00
|
|
|
|