2020-11-10 16:50:36 +00:00
|
|
|
ARG GO_IMAGE=gcr.io/gcp-runtimes/go1-builder:1.13
|
2019-06-26 11:41:22 -05:00
|
|
|
ARG RELEASE_IMAGE=scratch
|
|
|
|
FROM ${GO_IMAGE} as builder
|
2019-04-29 14:07:09 -05:00
|
|
|
|
2020-11-10 16:50:36 +00:00
|
|
|
ENV PATH "/usr/local/go/bin:$PATH"
|
|
|
|
|
2020-04-24 10:01:39 -05:00
|
|
|
# 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
|
|
|
|
|
2020-11-10 16:50:36 +00:00
|
|
|
RUN apt-get update -yq && apt-get upgrade -yq && apt-get install -y gcc make
|
|
|
|
|
2019-06-26 11:41:22 -05:00
|
|
|
SHELL [ "/bin/bash", "-cex" ]
|
|
|
|
WORKDIR /usr/src/airshipctl
|
2019-04-29 14:07:09 -05:00
|
|
|
|
2019-11-18 15:55:02 -06:00
|
|
|
# Take advantage of caching for dependency acquisition
|
|
|
|
COPY go.mod go.sum /usr/src/airshipctl/
|
|
|
|
RUN go mod download
|
2019-06-26 11:41:22 -05:00
|
|
|
|
2019-11-18 15:55:02 -06:00
|
|
|
COPY . /usr/src/airshipctl/
|
2019-06-26 11:41:22 -05:00
|
|
|
ARG MAKE_TARGET=build
|
2020-03-03 11:25:27 -05:00
|
|
|
RUN for target in $MAKE_TARGET; do make $target; done
|
2019-06-26 11:41:22 -05:00
|
|
|
|
|
|
|
FROM ${RELEASE_IMAGE} as release
|
2020-11-10 16:56:28 +01:00
|
|
|
|
|
|
|
LABEL org.opencontainers.image.authors='airship-discuss@lists.airshipit.org, irc://#airshipit@freenode' \
|
|
|
|
org.opencontainers.image.url='https://airshipit.org' \
|
|
|
|
org.opencontainers.image.documentation='https://docs.airshipit.org/airshipctl/' \
|
|
|
|
org.opencontainers.image.source='https://opendev.org/airship/airshipctl' \
|
|
|
|
org.opencontainers.image.vendor='The Airship Authors' \
|
|
|
|
org.opencontainers.image.licenses='Apache-2.0'
|
|
|
|
|
2020-10-09 18:06:21 +04:00
|
|
|
ARG BINARY=airshipctl
|
|
|
|
ENV BINARY=${BINARY}
|
|
|
|
COPY --from=builder /usr/src/airshipctl/bin/${BINARY} /usr/local/bin/${BINARY}
|
2019-07-09 13:52:24 -05:00
|
|
|
USER 65534
|
2020-10-09 18:06:21 +04:00
|
|
|
ENTRYPOINT /usr/local/bin/${BINARY}
|