2021-11-06 03:41:36 +00:00
|
|
|
FROM golang:1.17.2-alpine3.14 as builder
|
|
|
|
RUN apk update && apk add --no-cache git tzdata
|
|
|
|
WORKDIR /src
|
|
|
|
|
|
|
|
COPY go.mod go.sum /src/
|
|
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
RUN VERSION=$(git describe --tags --abbrev=0) BUILD=$(git rev-parse --short HEAD) && \
|
|
|
|
GOOS=linux GOARCH=amd64 \
|
|
|
|
go build -ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD} -w" \
|
2021-11-06 04:34:41 +00:00
|
|
|
-o /go/bin/breach
|
2021-11-06 03:41:36 +00:00
|
|
|
|
|
|
|
FROM alpine:3.14
|
|
|
|
ENV PATH="/go/bin:${PATH}"
|
|
|
|
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
|
2021-11-06 04:34:41 +00:00
|
|
|
COPY --from=builder /go/bin/breach /go/bin/breach
|
|
|
|
ENTRYPOINT ["/go/bin/breach"]
|