-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
38 lines (26 loc) · 1000 Bytes
/
Dockerfile
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
34
35
36
37
38
# BUILD
FROM golang:1.13-alpine as builder
RUN apk add --no-cache gcc build-base
RUN mkdir /app
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go test -v ./...
RUN GIT_COMMIT=$(git rev-parse --short HEAD 2> /dev/null || true) \
&& BUILDTIME=$(TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ') \
&& VERSION=$(git describe --abbrev=0 --tags 2> /dev/null || true) \
&& CGO_ENABLED=0 GOOS=linux go build --ldflags "-s -w \
-X github.com/labbsr0x/bindman-dns-bind9/version.Version=${VERSION:-unknow-version} \
-X github.com/labbsr0x/bindman-dns-bind9/version.GitCommit=${GIT_COMMIT} \
-X github.com/labbsr0x/bindman-dns-bind9/version.BuildTime=${BUILDTIME}" \
-a -installsuffix cgo -o /bindman-dns-bind9 main.go
## PKG
FROM alpine:3.11.2
RUN apk update \
&& apk add --no-cache ca-certificates bind-tools \
&& update-ca-certificates
VOLUME [ "/data" ]
COPY --from=builder /bindman-dns-bind9 /go/bin/
ENTRYPOINT [ "/go/bin/bindman-dns-bind9" ]
CMD [ "serve" ]