forked from influxdata/telegraf-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.multi-arch
26 lines (22 loc) · 959 Bytes
/
Dockerfile.multi-arch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.18 as builder
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.sum ./
# 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
RUN go mod download
# Copy the go source, build script and run it
# NOTE: please ensure that file list to copy is synced with Dockerfile
COPY main.go sidecar.go handler.go class_data.go errors.go watcher.go updater.go ./
COPY scripts/build-manager.sh /build-manager.sh
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN /build-manager.sh $TARGETPLATFORM $BUILDPLATFORM
# 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 /
COPY --from=builder /workspace/manager .
USER nonroot:nonroot
ENTRYPOINT ["/manager"]