airshipctl/krm-functions/templater/Dockerfile
Andrii Ostapenko 64b5401aa2
Pass GOPROXY to image build from environment and job
Change-Id: I9f9ce1853aeee0f832c458587fdc8fb9de5566ed
Signed-off-by: Andrii Ostapenko <andrii.ostapenko@att.com>
2021-06-09 18:51:08 -05:00

23 lines
855 B
Docker

ARG GO_IMAGE=gcr.io/gcp-runtimes/go1-builder:1.15
ARG PLUGINS_RELEASE_IMAGE=alpine:3.12.0
FROM ${GO_IMAGE} as builder
ARG GOPROXY=""
# Inject custom root certificate authorities if needed
# Docker does not have a good conditional copy statement and requires that a source file exists
# to complete the copy function without error. Therefore the README.md file will be copied to
# the image every time even if there are no .crt files.
COPY ./certs/* /usr/local/share/ca-certificates/
RUN update-ca-certificates
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY image/go.mod .
RUN /usr/local/go/bin/go mod download
COPY main.go .
RUN /usr/local/go/bin/go build -v -o /usr/local/bin/config-function ./
FROM ${PLUGINS_RELEASE_IMAGE} as release
COPY --from=builder /usr/local/bin/config-function /usr/local/bin/config-function
CMD ["/usr/local/bin/config-function"]