Skip to content

Commit 95c52dc

Browse files
committed
Refactor Dockerfile to use Rust for building doh-proxy instead of Go
1 parent decaba3 commit 95c52dc

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

Dockerfile

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
11
# --- Build Stage ---
2-
# Use the official Go image to build the application
3-
FROM golang:1.21-alpine AS builder
4-
5-
# Install Git, which is needed to download the source code
6-
RUN apk add --no-cache git
2+
# Use the official Rust image to compile the application
3+
FROM rust:latest AS builder
74

5+
# Create a new, empty project
86
WORKDIR /app
97

10-
# Download and compile the doh-server application
11-
RUN go install github.com/dnscrypt/doh-server/cmd/doh-server@latest
8+
# Install the doh-proxy binary. The --no-default-features flag is crucial
9+
# as it builds the version without built-in HTTPS, which is what we need
10+
# when running behind a reverse proxy like Nginx.
11+
RUN cargo install doh-proxy --no-default-features
1212

1313

1414
# --- Final Stage ---
15-
# Use a minimal Alpine image for the final container
15+
# Use a minimal Alpine image for a small final container size
1616
FROM alpine:latest
1717

18-
WORKDIR /app
19-
20-
# Copy the compiled doh-server application from the build stage
21-
COPY --from=builder /go/bin/doh-server .
22-
23-
# Expose the internal port the server will listen on
24-
EXPOSE 8053
18+
# Copy the compiled doh-proxy application from the build stage
19+
COPY --from=builder /usr/local/cargo/bin/doh-proxy /usr/local/bin/
2520

2621
# Set the command to run when the container starts
27-
ENTRYPOINT [ "./doh-server" ]
22+
ENTRYPOINT [ "doh-proxy" ]

0 commit comments

Comments
 (0)