-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd8fa19
commit b820c0a
Showing
1 changed file
with
21 additions
and
7 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,12 +1,26 @@ | ||
FROM rust:1.70-slim | ||
FROM rust:1.67-slim as builder | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y clang cmake build-essential | ||
WORKDIR /usr/src/app | ||
COPY . . | ||
|
||
WORKDIR /app | ||
# Will build and cache the binary and dependent crates in release mode | ||
RUN --mount=type=cache,target=/usr/local/cargo,from=rust:latest,source=/usr/local/cargo \ | ||
--mount=type=cache,target=target \ | ||
cargo build --release && mv ./target/release/mutinynet-faucet-rs ./mutinynet-faucet-rs | ||
|
||
COPY . . | ||
# Runtime image | ||
FROM debian:bookworm-slim | ||
|
||
RUN apt update && apt install -y openssl libpq-dev pkg-config libc6 clang cmake build-essential | ||
|
||
# Run as "app" user | ||
RUN useradd -ms /bin/bash app | ||
|
||
USER app | ||
WORKDIR /app | ||
|
||
RUN cargo build --release | ||
# Get compiled binaries from builder's cargo install directory | ||
COPY --from=builder /usr/src/app/mutinynet-faucet-rs /app/mutinynet-faucet-rs | ||
|
||
ENTRYPOINT ["/bin/bash", "-c", "./target/release/mutinynet-faucet-rs ${FLAGS}"] | ||
# Run the app | ||
CMD ./mutinynet-faucet-rs |