teleport/integrations/kube-agent-updater/Dockerfile
Hugo Shaka 68bf10d3d1
Fixes for teleport-kube-agent-updater (#24746)
* integrations/updater: disable CGO to ensure static builds

* helm: fix updater selectors in `teleport-kube-agent`

* helm: fix updater flags

* helm: make the updater able to watch secrets, create events and acquire leases

* integrations/updater: add dummy healthz route

* integrations/updater: fix typo in DEBUG instructions

* helm: update test snapshots
2023-04-20 13:17:03 +00:00

35 lines
1.2 KiB
Docker

ARG BUILDBOX
ARG BASE_IMAGE=gcr.io/distroless/static-debian11
# BUILDPLATFORM is provided by Docker/buildx
FROM --platform=$BUILDPLATFORM $BUILDBOX as builder
WORKDIR /go/src/github.com/gravitational/teleport/integrations/kube-agent-updater
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# Download and Cache dependencies before building and copying source
# This will prevent re-downloading the operator's dependencies if they have not changed as this
# `run` layer will be cached
RUN go mod download
COPY cmd/ cmd/
COPY pkg/ pkg/
ARG TARGETOS
ARG TARGETARCH
# Build the program. We rely on golang's cross-compilation capabilities for multiarch building.
RUN echo "Targeting $TARGETOS/$TARGETARCH" && \
GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 \
go build -a -o /go/bin/teleport-kube-agent-updater github.com/gravitational/teleport/integrations/kube-agent-updater/cmd/teleport-kube-agent-updater
# Create the image with the build operator on the $TARGETPLATFORM
# TARGETPLATFORM is provided by Docker/buildx
FROM --platform=$TARGETPLATFORM $BASE_IMAGE
WORKDIR /
COPY --from=builder /go/bin/teleport-kube-agent-updater .
ENTRYPOINT ["/teleport-kube-agent-updater"]