-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (32 loc) · 1.28 KB
/
Dockerfile
File metadata and controls
44 lines (32 loc) · 1.28 KB
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
37
38
39
40
41
42
43
44
# syntax=docker/dockerfile:1
# SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and IronCore contributors
# SPDX-License-Identifier: Apache-2.0
FROM golang:1.24-alpine3.22 AS builder
RUN apk add --no-cache --no-progress git make
ARG BININFO_BUILD_DATE
ARG BININFO_COMMIT_HASH
ARG BININFO_VERSION
ARG TARGETOS
ARG TARGETARCH
WORKDIR /workspace
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=bind,source=go.mod,target=go.mod \
--mount=type=bind,source=go.sum,target=go.sum \
go mod download -x
RUN --mount=type=bind,target=.,readwrite \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOTOOLCHAIN=local make install
FROM gcr.io/distroless/static:nonroot
ARG BININFO_BUILD_DATE
ARG BININFO_COMMIT_HASH
ARG BININFO_VERSION
LABEL source_repository="https://github.com/ironcore-dev/network-operator" \
org.opencontainers.image.url="https://github.com/ironcore-dev/network-operator" \
org.opencontainers.image.created=${BININFO_BUILD_DATE} \
org.opencontainers.image.revision=${BININFO_COMMIT_HASH} \
org.opencontainers.image.version=${BININFO_VERSION}
COPY --from=builder /usr/bin/network-operator /manager
USER 65532:65532
WORKDIR /
ENTRYPOINT [ "/manager" ]