mirror of
https://github.com/gravitational/teleport.git
synced 2026-11-04 19:12:46 +08:00
* 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
33 lines
898 B
Docker
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"]
|