-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (30 loc) · 922 Bytes
/
Dockerfile
File metadata and controls
41 lines (30 loc) · 922 Bytes
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
# ========================
# Build Image
# ========================
FROM rust:1.86.0-alpine3.20 AS builder
# Install build dependencies
RUN apk add --no-cache \
gcc \
libc-dev
# Set the working directory
WORKDIR /usr/src/app
# Copy over Cargo.toml and Cargo.lock for dependency caching
COPY Cargo.toml Cargo.lock ./
# Copy over all the source code
COPY . .
# Build the project in release mode
RUN cargo build --release
# ========================
# Runtime Image
# ========================
FROM alpine:3.20
ARG TARGETARCH=x86_64
# Install runtime dependencies (only ca-certificates)
RUN apk add --no-cache ca-certificates
# Copy the compiled binary from the builder stage
COPY --from=builder /usr/src/app/target/release/pkdns /usr/local/bin
COPY --from=builder /usr/src/app/target/release/pkdns-cli /usr/local/bin
# Expose the DNS port
EXPOSE 53
# Set the default command to run the binary
CMD ["pkdns"]