Skip to content
Dockerfile 820 B
Newer Older
Timothee Gosselin's avatar
Timothee Gosselin committed
# Build the manager binary
Timothee Gosselin's avatar
Timothee Gosselin committed
#FROM golang:1.13 as builder
Timothee Gosselin's avatar
Timothee Gosselin committed

Timothee Gosselin's avatar
Timothee Gosselin committed
#WORKDIR /workspace
Timothee Gosselin's avatar
Timothee Gosselin committed
# Copy the Go Modules manifests
Timothee Gosselin's avatar
Timothee Gosselin committed
#COPY go.mod go.mod
#COPY go.sum go.sum
Timothee Gosselin's avatar
Timothee Gosselin committed
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
Timothee Gosselin's avatar
Timothee Gosselin committed
#RUN go mod download
Timothee Gosselin's avatar
Timothee Gosselin committed

# Copy the go source
Timothee Gosselin's avatar
Timothee Gosselin committed
#COPY main.go main.go
#COPY api/ api/
#COPY controllers/ controllers/
Timothee Gosselin's avatar
Timothee Gosselin committed

# Build
Timothee Gosselin's avatar
Timothee Gosselin committed
#RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
Timothee Gosselin's avatar
Timothee Gosselin committed

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /
Timothee Gosselin's avatar
Timothee Gosselin committed
#COPY --from=builder /workspace/manager .
COPY manager .
Timothee Gosselin's avatar
Timothee Gosselin committed
USER nonroot:nonroot

ENTRYPOINT ["/manager"]