-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (21 loc) · 605 Bytes
/
Dockerfile
File metadata and controls
27 lines (21 loc) · 605 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
FROM golang:1.26.1-alpine3.23 as builder
ENV GO111MODULE=on
ARG VERSION=dev
WORKDIR /go/src/github.com/mxssl/dns
COPY . .
# Install external dependcies
RUN apk add --no-cache \
ca-certificates \
curl \
git
# Compile binary
RUN CGO_ENABLED=0 \
GOOS=`go env GOHOSTOS` \
GOARCH=`go env GOHOSTARCH` \
go build -v -o dns -ldflags "-X github.com/mxssl/dns/cmd.version=$VERSION"
# Copy compiled binary to clear Alpine Linux image
FROM alpine:3.23
WORKDIR /
RUN apk add --no-cache ca-certificates
COPY --from=builder /go/src/github.com/mxssl/dns/dns /usr/local/bin/dns
RUN chmod +x /usr/local/bin/dns