Files
teleport/operator/Dockerfile
T
Hugo Shaka 2ef2de956a Use Teleport's standard buildbox (#17122)
* Use Teleport's standard buildbox

This commit edits the teleport-operator container image build process to
rely on Teleport's standard buildbox. This will make sure we are using a
single go version at all time.

This also removed unused environment variables from
`operator/Makefile`.

* Extract BUILDBOX variables out of build.assets/Makefile
* Put `teleport-operator` bin out of the Teleport source volume
2022-10-11 15:19:38 +00:00

33 lines
898 B
Docker

ARG BUILDBOX
FROM $BUILDBOX as builder
WORKDIR /go/src/github.com/gravitational/teleport
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# we have to copy the API before `go mod download` because go.mod has a replace directive for it
COPY api/ api/
# cache deps before building and copying source
# this way we don't need to re-download deps when the deps are the same
RUN go mod download
COPY *.go ./
COPY lib/ lib/
COPY operator/apis/ operator/apis/
COPY operator/controllers/ operator/controllers/
COPY operator/sidecar/ operator/sidecar/
COPY operator/main.go operator/main.go
COPY operator/namespace.go operator/namespace.go
# Build
RUN GOOS=linux GOARCH=amd64 go build -a -o /go/bin/teleport-operator github.com/gravitational/teleport/operator
FROM gcr.io/distroless/cc
WORKDIR /
COPY --from=builder /go/bin/teleport-operator .
ENTRYPOINT ["/teleport-operator"]