-
Notifications
You must be signed in to change notification settings - Fork 27
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
49fd26a
commit 33daae6
Showing
1 changed file
with
30 additions
and
10 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,14 +1,34 @@ | ||
# Use an official Rust image as the base image | ||
FROM rust:latest | ||
# Use Rust official image for the build stage | ||
FROM rust:latest AS build | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
# Create and set the working directory | ||
WORKDIR /usr/src/app | ||
|
||
# Copy the Rust project to the working directory | ||
COPY . . | ||
|
||
# Install necessary dependencies for building the Rust project | ||
RUN apt-get update && apt-get install -y libssl-dev pkg-config && \ | ||
# Clean up the apt cache to reduce image size | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Build the Rust project | ||
# If your project uses a custom profile, replace `--release` with `--profile <your-profile>` | ||
RUN RUSTFLAGS='-C target-cpu=native' cargo build --release | ||
|
||
# Copy the project files into the container | ||
COPY / /app | ||
# Start a new stage to create a smaller final image | ||
FROM debian:bookworm | ||
|
||
# Install runtime dependencies | ||
RUN apt-get update && apt-get install -y openssl ca-certificates && \ | ||
# Clean up the apt cache to reduce image size | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Create a directory for the application | ||
WORKDIR /app | ||
|
||
# Install libssl-dev | ||
RUN apt-get update && apt-get install -y libssl-dev | ||
# Copy the built binary from the build stage to the application directory | ||
COPY --from=build /usr/src/app/target/release/blutgang /app/blutgang | ||
|
||
# Build and run the Rust project | ||
CMD ["cargo", "run", "--profile", "maxperf", "--", "-c", "config.toml"] | ||
# Set the command to run the application | ||
CMD ["./blutgang", "-c", "config.toml"] |