forked from skupperproject/skupper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.controller
More file actions
36 lines (26 loc) · 871 Bytes
/
Dockerfile.controller
File metadata and controls
36 lines (26 loc) · 871 Bytes
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
27
28
29
30
31
32
33
34
35
36
ARG GO_IMAGE_BASE_TAG=1.25
FROM --platform=$BUILDPLATFORM golang:${GO_IMAGE_BASE_TAG} AS builder
ARG TARGETARCH
RUN apt update && apt install -y jq
WORKDIR /go/src/app
COPY go.mod .
COPY go.sum .
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
COPY . .
# Build statically linked binary
ENV CGO_ENABLED=0
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
make -B build-controller GOARCH=$TARGETARCH
# Use scratch for minimal image size
FROM scratch
LABEL \
org.opencontainers.image.title="Skupper Controller" \
org.opencontainers.image.description="Kubernetes controller for operating skupper networks"
WORKDIR /app
# Copy the statically linked binary
COPY --from=builder /go/src/app/controller .
# Use numeric user ID (no need to create user in scratch)
USER 10000
CMD ["/app/controller"]