-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (25 loc) 路 732 Bytes
/
Copy pathDockerfile
File metadata and controls
33 lines (25 loc) 路 732 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
# syntax=docker/dockerfile:1
# NOTE: I build images for multi-arch because goreleaser works strange with multi-stage builds
# Need a lot of additional configuration to build multi-arch images
# STAGE 1: building the executable
FROM docker.io/golang:1.26.1-alpine3.23 AS builder
WORKDIR /build
ARG VERSION
ARG COMMIT
ARG DATE
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 \
go build \
-ldflags="-w -s \
-X main.version='${VERSION}' \
-X main.commit='${COMMIT}' \
-X main.date='${DATE}'" \
-o /go-avahi-cname
# STAGE 2: build the container to run
FROM scratch
COPY --from=builder /go-avahi-cname /go-avahi-cname
EXPOSE 5353/udp
ENTRYPOINT ["/go-avahi-cname"]
CMD [ "subdomain" ]