2021-02-23 09:26:00 +00:00
|
|
|
FROM golang:1.16-buster as builder
|
2021-02-19 23:58:01 +00:00
|
|
|
|
2021-06-27 10:11:39 +00:00
|
|
|
ARG LD_FLAGS
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
|
2021-02-19 23:58:01 +00:00
|
|
|
WORKDIR /app
|
|
|
|
COPY . .
|
|
|
|
|
2021-06-27 10:11:39 +00:00
|
|
|
RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \
|
|
|
|
export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2)
|
|
|
|
|
|
|
|
RUN go env
|
|
|
|
|
2021-02-19 23:58:01 +00:00
|
|
|
RUN go get -d -v \
|
|
|
|
&& go install -v
|
|
|
|
|
2021-06-27 10:11:39 +00:00
|
|
|
RUN CGO_ENABLED=0 go build -ldflags="${LD_FLAGS}" -o /app/build/policyreporter -v
|
2021-02-19 23:58:01 +00:00
|
|
|
|
2021-06-27 10:11:39 +00:00
|
|
|
FROM scratch
|
2021-02-19 23:58:01 +00:00
|
|
|
LABEL MAINTAINER "Frank Jogeleit <frank.jogeleit@gweb.de>"
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
USER 1234
|
|
|
|
|
|
|
|
COPY --from=builder /app/LICENSE.md .
|
|
|
|
COPY --from=builder /app/build/policyreporter /app/policyreporter
|
|
|
|
|
|
|
|
EXPOSE 2112
|
|
|
|
|
2021-02-22 20:18:39 +00:00
|
|
|
ENTRYPOINT ["/app/policyreporter", "run"]
|