airshipctl/krm-functions/cloud-init/Dockerfile
Alexey Odinokov 37c2854cce Switching airshipctl and krm-functions to kustomize 4.2.0
Reworked build process of dependent krm functions
to use the latest airshipctl

Change-Id: If4c7f992123b86442980f381ae69fb003f4851e3
2021-07-22 17:06:32 +00:00

33 lines
1.1 KiB
Docker

ARG GO_IMAGE=amd64/golang:1.16.6-buster
ARG RELEASE_IMAGE=quay.io/airshipit/alpine:3.13.5
FROM ${GO_IMAGE} as builder
ARG GOPROXY=""
ENV PATH "/usr/local/go/bin:$PATH"
# 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
RUN apt-get update -yq && apt-get upgrade -yq && apt-get install -y gcc make
SHELL [ "/bin/bash", "-cex" ]
WORKDIR /usr/src/airshipctl
# Take advantage of caching for dependency acquisition
COPY go.mod go.sum /usr/src/airshipctl/
RUN go mod download
COPY . /usr/src/airshipctl/
ARG MAKE_TARGET=bin/cloud-init
RUN make ${MAKE_TARGET}
FROM ${RELEASE_IMAGE} as release
ARG MAKE_TARGET=bin/cloud-init
COPY --from=builder /usr/src/airshipctl/${MAKE_TARGET} /usr/local/bin/config-function
USER 65534
CMD ["/usr/local/bin/config-function"]