aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile31
1 files changed, 31 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..36c0691
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,31 @@
+FROM docker.io/library/golang:1.22-alpine AS builder
+
+WORKDIR /app
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY . .
+RUN CGO_ENABLED=0 GOOS=linux go build -o strip-dns64
+
+FROM alpine:3.19
+
+RUN apk --no-cache add ca-certificates libcap
+
+WORKDIR /app
+COPY --from=builder /app/strip-dns64 .
+COPY entrypoint.sh .
+
+RUN adduser -D -H -h /app dnsuser
+RUN chown dnsuser:dnsuser /app/strip-dns64 /app/entrypoint.sh
+RUN chmod +x /app/entrypoint.sh
+
+RUN setcap cap_net_bind_service=+ep /app/strip-dns64
+
+ENV UPSTREAM_DNS="[2606:4700:4700::1111]:53"
+ENV LISTEN_ADDRS="[::]:53"
+
+USER dnsuser
+
+ENTRYPOINT ["/app/entrypoint.sh"]
+
+EXPOSE 53/udp