18 lines
752 B
Docker
18 lines
752 B
Docker
# syntax=docker/dockerfile:1
|
|
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.9.0 AS xx
|
|
FROM --platform=$BUILDPLATFORM golang:1.27-alpine AS build
|
|
ARG TARGETPLATFORM
|
|
ARG VERSION=dev
|
|
COPY --from=xx / /
|
|
WORKDIR /app
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 GOOS=linux xx-go build -trimpath -ldflags "-w -s -X main.version=${VERSION}" -o /adblock-dns ./cmd/adblock-dns
|
|
|
|
# static, no shell, non-root; listens on unprivileged ports only (5353, 8853, 8443, 9153, 8080)
|
|
FROM jonasled.dev/infra/images/scratch-rootless:latest@sha256:8c33ba4e489ce0decd60f00ce63af60994b9b72cd39668284daea8eae1d809b7
|
|
COPY --from=build /adblock-dns /adblock-dns
|
|
ENV DATA_DIR=/data
|
|
EXPOSE 5353/udp 5353/tcp 8853 8443 9153 8080
|
|
ENTRYPOINT ["/adblock-dns"]
|