vino/nodelabeler/Dockerfile
Alexander Hughes 00125cbdef Add image build jobs
The images built from ViNO code are not currently stored in a public
registry, this change adds Zuul jobs to push the controller and
nodelabeler images to Quay.io where they can be consumed by the
community.

Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
Change-Id: I19d7b9954a20af07cb6ffd1f1e8f17f3ed6e754c
2021-01-15 15:08:09 +00:00

33 lines
1.3 KiB
Docker

# Default base images for builder and release images, can be overridden during build
ARG BUILDER_IMAGE=gcr.io/gcp-runtimes/go1-builder:1.13
ARG RELEASE_IMAGE=scratch
# Create the binary in a builder image, so the release image can be kept small
FROM ${BUILDER_IMAGE} as builder
ENV PATH "/usr/local/go/bin:$PATH"
SHELL [ "/bin/bash", "-cex" ]
WORKDIR /usr/src/nodelabeler
# Take advantage of caching for dependency acquisition
COPY go.mod go.sum /usr/src/nodelabeler/
RUN go mod download
# Create a static binary - because net package is used, a dynamic binary will not work with scratch
COPY nodelabeler/main.go /usr/src/nodelabeler/
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags="-w -s -extldflags '-static'" -o /go/bin/nodelabeler
# Transfer the binary to a clean release image
FROM ${RELEASE_IMAGE}
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/nodelabeler/' \
org.opencontainers.image.source='https://opendev.org/airship/nodelabeler' \
org.opencontainers.image.vendor='The Airship Authors' \
org.opencontainers.image.licenses='Apache-2.0'
COPY --from=builder /go/bin/nodelabeler /go/bin/nodelabeler
USER 65534
CMD ["./go/bin/nodelabeler"]