Skip to content

Commit

Permalink
Use static linking (backport from master)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaseizinger committed Jan 24, 2024
1 parent 770dfee commit ef97ef9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions interop-tests/Dockerfile.chromium
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --package interop-tests --target wasm32-unknown-unknown --recipe-path recipe.json
RUN cargo chef cook --release --package interop-tests --bin wasm_ping --recipe-path recipe.json
RUN RUSTFLAGS='-C target-feature=+crt-static' cargo chef cook --release --package interop-tests --target x86_64-unknown-linux-gnu --bin wasm_ping --recipe-path recipe.json
# Build application
COPY . .
RUN wasm-pack build --target web interop-tests
RUN cargo build --release --package interop-tests --bin wasm_ping
RUN RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --package interop-tests --target x86_64-unknown-linux-gnu --bin wasm_ping

FROM selenium/standalone-chrome:120.0
COPY --from=builder /app/target/release/wasm_ping /usr/local/bin/testplan
FROM selenium/standalone-chrome:115.0
COPY --from=builder /app/target/x86_64-unknown-linux-gnu/release/wasm_ping /usr/local/bin/testplan
ENV RUST_BACKTRACE=1
ENTRYPOINT ["testplan"]
12 changes: 6 additions & 6 deletions interop-tests/Dockerfile.native
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# syntax=docker/dockerfile:1.5-labs
FROM rust:1.73.0 as chef
RUN wget -q -O- https://github.com/LukeMathWalker/cargo-chef/releases/download/v0.1.62/cargo-chef-x86_64-unknown-linux-gnu.tar.gz | tar -zx -C /usr/local/bin
FROM lukemathwalker/cargo-chef:0.1.62-rust-1.73.0 as chef
WORKDIR /app

FROM chef AS planner
Expand All @@ -10,12 +9,13 @@ RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --package interop-tests --bin native_ping --recipe-path recipe.json
RUN RUSTFLAGS='-C target-feature=+crt-static' cargo chef cook --release --package interop-tests --target $(rustc -vV | grep host | awk '{print $2}') --bin native_ping --recipe-path recipe.json
# Build application
COPY . .
RUN cargo build --release --package interop-tests --bin native_ping
RUN RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --package interop-tests --target $(rustc -vV | grep host | awk '{print $2}') --bin native_ping
RUN cp /app/target/$(rustc -vV | grep host | awk '{print $2}')/release/native_ping /usr/local/bin/testplan

FROM gcr.io/distroless/cc-debian12
COPY --from=builder /app/target/release/native_ping /usr/local/bin/testplan
FROM scratch
COPY --from=builder /usr/local/bin/testplan /usr/local/bin/testplan
ENV RUST_BACKTRACE=1
ENTRYPOINT ["testplan"]

0 comments on commit ef97ef9

Please sign in to comment.