A declarative operator for libvirt configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.3 KiB

# Default base images for builder and release images, can be overridden during build
ARG BUILDER_IMAGE=gcr.io/gcp-runtimes/go1-builder:1.13
# 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
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' \
COPY --from=builder /go/bin/nodelabeler /go/bin/nodelabeler
USER 65534
CMD ["./go/bin/nodelabeler"]