github.com/autonomy/conform@v0.1.0-alpha.16/Dockerfile (about) 1 ARG GOLANG_IMAGE 2 FROM ${GOLANG_IMAGE} AS common 3 ENV CGO_ENABLED 0 4 ENV GO111MODULES on 5 WORKDIR /conform 6 COPY go.mod ./ 7 COPY go.sum ./ 8 RUN go mod download 9 RUN go mod verify 10 COPY ./ ./ 11 RUN go list -mod=readonly all 12 13 FROM common AS build 14 ARG TAG 15 ARG SHA 16 ARG BUILT 17 ENV GOOS linux 18 ENV GOARCH amd64 19 RUN go build -o /conform-${GOOS}-${GOARCH} -ldflags "-s -w -X \"github.com/autonomy/conform/cmd.Tag=${TAG}\" -X \"github.com/autonomy/conform/cmd.SHA=${SHA}\" -X \"github.com/autonomy/conform/cmd.Built=${BUILT}\"" . 20 21 ARG TAG 22 ARG SHA 23 ARG BUILT 24 ENV GOOS darwin 25 ENV GOARCH amd64 26 RUN go build -o /conform-${GOOS}-${GOARCH} -ldflags "-s -w -X \"github.com/autonomy/conform/cmd.Tag=${TAG}\" -X \"github.com/autonomy/conform/cmd.SHA=${SHA}\" -X \"github.com/autonomy/conform/cmd.Built=${BUILT}\"" . 27 28 FROM common AS test 29 ENV GOOS linux 30 ENV GOARCH amd64 31 COPY ./hack ./hack 32 RUN chmod +x ./hack/test.sh 33 RUN ./hack/test.sh --all 34 35 FROM alpine:3.9 as ca-certificates 36 RUN apk add --update --no-cache ca-certificates 37 38 FROM scratch AS image 39 LABEL "com.github.actions.name"="Conform Action" 40 LABEL "com.github.actions.description"="Policy enforcement for your pipelines." 41 LABEL "com.github.actions.icon"="check-circle" 42 LABEL "com.github.actions.color"="black" 43 LABEL "repository"="https://github.com/talos-systems/conform.git" 44 LABEL "maintainer"="Andrew Rynhard <andrew@andrewrynhard.com>" 45 COPY --from=ca-certificates /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ 46 COPY --from=build /conform-linux-amd64 /conform 47 ENTRYPOINT [ "/conform" ] 48 CMD [ "enforce" ]