2021-12-28 15:20:31 +08:00
|
|
|
FROM golang:1.17 as builder
|
|
|
|
ENV GO111MODULE on
|
2021-12-28 16:45:08 +08:00
|
|
|
ENV GOPROXY https://goproxy.cn,direct
|
2021-12-28 15:20:31 +08:00
|
|
|
WORKDIR /go/cache
|
|
|
|
ADD go.mod .
|
|
|
|
ADD go.sum .
|
|
|
|
RUN go mod download
|
|
|
|
WORKDIR /go/src
|
|
|
|
ADD . .
|
|
|
|
RUN go mod tidy
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o main
|
|
|
|
|
|
|
|
FROM alpine as drone_plugin
|
|
|
|
WORKDIR /go/src
|
|
|
|
#LABEL maintainer "The Prometheus Authors <prometheus-developers@googlegroups.com>"
|
|
|
|
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
|
|
|
|
# copy main and config from builder
|
|
|
|
COPY --from=builder /go/src/main ./
|
|
|
|
ENV TZ=Asia/Shanghai
|
|
|
|
ENV DRONE_DEBUG=true
|
|
|
|
ENV DRONE_SECRET=6dc7224d3e415d2d45b55eb04a7d2e9e
|
|
|
|
RUN chmod +x ./main
|
|
|
|
EXPOSE 8080
|
|
|
|
CMD ["./main"]
|