-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (32 loc) · 1.04 KB
/
Dockerfile
File metadata and controls
44 lines (32 loc) · 1.04 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Stage 1: Build the application
FROM rust:1.82-slim AS builder
WORKDIR /usr/src/app
# Copy the Cargo files for dependency caching
COPY Cargo.toml Cargo.lock ./
# Create a dummy main.rs to build dependencies
RUN mkdir -p src && \
echo "fn main() {}" > src/main.rs && \
cargo build --release && \
rm -rf src
# Copy the actual source code
COPY src/ src/
# Build the application
RUN cargo build --release
# Stage 2: Create the runtime image
FROM debian:bookworm-slim
WORKDIR /app
# Install OpenSSL and CA certificates (often needed for HTTPS/TLS)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
libssl3 && \
rm -rf /var/lib/apt/lists/*
# Copy the binary from the builder stage
COPY --from=builder /usr/src/app/target/release/mustermann /app/mustermann
# Copy the entrypoint script
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
# Set the entrypoint script
ENTRYPOINT ["/app/entrypoint.sh"]
# Default command line arguments (can be overridden)
CMD ["--log", "stdout"]