-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDockerfile.labeler
48 lines (37 loc) · 1.43 KB
/
Dockerfile.labeler
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
45
46
47
48
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2020-2024 Intel Corporation
FROM docker.io/golang:alpine3.19 as builder
WORKDIR /workspace
COPY go.mod go.sum ./
RUN go mod download
COPY cmd cmd/
COPY pkg pkg/
COPY apis apis/
RUN apk add --no-cache curl
RUN curl https://pci-ids.ucw.cz/v2.2/pci.ids.gz -o pci.ids.gz && gunzip pci.ids.gz
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on \
go build -trimpath -mod=readonly -gcflags="all=-spectre=all -N -l" \
-asmflags="all=-spectre=all" -ldflags="all=-s -w" -a -o \
node_labeler cmd/labeler/main.go
FROM docker.io/redhat/ubi9-micro:9.3-15
ARG VERSION
### Required OpenShift Labels
LABEL name="Intel® Ethernet Operator discovery container" \
vendor="Intel Corporation" \
version=$VERSION \
release="1" \
summary="Intel® Ethernet Operator discovery container labels kubernetes nodes that contain the PCI \
devices as set in the config file (typically Intel Ethernet E810)" \
description="The container detects the relevant PCI devices, labels the nodes that contain them \
and removes the label for the nodes that do not."
COPY --from=builder /workspace/pci.ids /usr/share/misc/pci.ids
USER 1001
WORKDIR /labeler-workspace
COPY --from=builder /workspace/node_labeler .
USER root
RUN mkdir /licenses
COPY LICENSE /licenses/LICENSE.txt
RUN chown 1001 /licenses
USER 1001
ENTRYPOINT ["bash", "-c", "/labeler-workspace/node_labeler && sleep infinity"]