-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
54 lines (34 loc) · 1.19 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Builder
FROM golang:1.18-alpine as builder
RUN apk add --no-cache make git
WORKDIR /app
COPY go.mod ./
COPY go.sum ./
RUN go mod download
ARG VERSION=unknown
ARG BUILD_TIME=unknown
ARG COMMIT_HASH=unknown
COPY . ./
RUN CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64 \
go build \
-trimpath \
-ldflags '\
-X "github.com/go-zoox/lighthouse/constants.Version=${VERSION}" \
-X "github.com/go-zoox/lighthouse/constants.BuildTime=${BUILD_TIME}" \
-X "github.com/go-zoox/lighthouse/constants.CommitHash=${COMMIT_HASH}" \
-w -s -buildid= \
' \
-v -o lighthouse
# Product
FROM scratch
LABEL MAINTAINER="Zero<tobewhatwewant@gmail.com>"
LABEL org.opencontainers.image.source="https://github.com/go-zoox/lighthouse"
ARG VERSION=v1.0.0
COPY --from=builder /app/lighthouse /
COPY conf/lighthouse.yaml /conf/lighthouse.yaml
EXPOSE 53
ENV GIN_MODE=release
ENV VERSION=${VERSION}
CMD ["/lighthouse", "-c", "/conf/lighthouse.yaml"]