airshipctl/krm-functions/cloud-init/Dockerfile.sample
Alexander Hughes 9105c6bcd0 Fix openssl in krm-functions images
Users behind firewalls may be unable to build all the airshipctl
images as a result of OpenSSL errors stemming from certificates used
with the proxy. To address this, the images impacted have been
updated to copy the proxy certificate from airshipctl/certs into
the image and run update-ca-certificates command. This is the same
behavior that already exists in the base airshipctl image and is
simply being extended to the images in krm-functions.

Change-Id: I436d1e25fb0726ab7576fec44a7ef2f9fd20f2bd
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
2021-04-09 10:52:38 -04:00

20 lines
753 B
Docker

FROM gcr.io/gcp-runtimes/go1-builder:1.15 as builder
# 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 alpine:latest
COPY --from=builder /usr/local/bin/config-function /usr/local/bin/config-function
CMD ["/usr/local/bin/config-function"]