Skip to content

Commit

Permalink
Detect arch in a script and target linux-musl
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomrsantos committed Oct 24, 2023
1 parent 6c0eb70 commit b6f763c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions hole-punching-tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
# syntax=docker/dockerfile:1.5-labs
FROM rust:1.72.0 as builder

ARG RUST_TARGET

RUN rustup target add $RUST_TARGET

RUN --mount=type=cache,target=/var/cache/apt apt-get update && apt-get install -y musl-dev musl-tools

# Run with access to the target cache to speed up builds
WORKDIR /workspace
ADD . .
RUN --mount=type=cache,target=./target \
--mount=type=cache,target=/usr/local/cargo/registry \
cargo build --release --package hole-punching-tests && \
mv ./target/release/hole-punching-tests /usr/local/bin/hole-punching-tests
cargo build --release --package hole-punching-tests --target $RUST_TARGET

RUN --mount=type=cache,target=./target \
mv ./target/$RUST_TARGET/release/hole-punching-tests /usr/local/bin/hole-punching-tests

FROM alpine:3
COPY --from=builder /usr/local/bin/hole-punching-tests /usr/bin/hole-punch-client
Expand Down

0 comments on commit b6f763c

Please sign in to comment.