-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
25 lines (24 loc) · 758 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# First stage: Build the Rust application
FROM rust:1.79 AS builder
# Install system dependencies
RUN apt-get update && \
apt-get install -y cmake pkg-config && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set up the working directory
WORKDIR /app
# Copy the Rust project's source files
COPY . .
# Build the Rust project
RUN cargo build --release
# Second stage: Create a smaller runtime image
FROM ubuntu:22.04
# Install necessary runtime dependencies
RUN apt-get update && \
apt-get install -y libssl3 ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Copy the compiled binary from the builder stage
COPY --from=builder /app/target/release/rustdress /usr/local/bin/
# Run the Rust binary
CMD ["rustdress"]