generated from PaulRBerg/hardhat-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use multistage to reduce test image size (#187)
- Loading branch information
1 parent
cd5e349
commit 7258206
Showing
3 changed files
with
33 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
FROM rust:1.81 | ||
RUN apt-get update && apt-get install -y iptables | ||
# Stage 1: Build | ||
FROM rust:1.81 AS builder | ||
|
||
WORKDIR /app | ||
COPY ./net/tests/entrypoint.sh entrypoint.sh | ||
COPY . . | ||
RUN cargo build --bin p2p_test | ||
RUN cargo build --release --bin p2p_test | ||
|
||
# Stage 2: Runtime | ||
FROM debian:bookworm-slim | ||
|
||
WORKDIR /app | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends iptables ca-certificates && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=builder /app/target/release/p2p_test /app/ | ||
COPY net/tests/entrypoint.sh /app/ | ||
RUN chmod +x /app/entrypoint.sh | ||
|
||
ENTRYPOINT ["/app/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters