2021-04-20 07:42:33 +00:00
|
|
|
ARG BASE_IMAGE_FULL
|
|
|
|
ARG BASE_IMAGE_MINIMAL
|
|
|
|
|
2018-05-28 10:47:56 +00:00
|
|
|
# Build node feature discovery
|
2022-03-16 14:43:56 +00:00
|
|
|
FROM golang:1.18-buster as builder
|
2016-09-20 17:42:00 +00:00
|
|
|
|
2021-12-23 10:22:21 +00:00
|
|
|
# Build and install the grpc-health-probe binary
|
2021-12-22 14:18:13 +00:00
|
|
|
RUN GRPC_HEALTH_PROBE_VERSION=v0.4.6 && \
|
2021-12-23 10:22:21 +00:00
|
|
|
go install github.com/grpc-ecosystem/grpc-health-probe@${GRPC_HEALTH_PROBE_VERSION} \
|
|
|
|
# Rename it as it's referenced as grpc_health_probe in the deployment yamls
|
|
|
|
# and in its own project https://github.com/grpc-ecosystem/grpc-health-probe
|
|
|
|
&& mv /go/bin/grpc-health-probe /go/bin/grpc_health_probe
|
2021-08-11 20:13:34 +00:00
|
|
|
|
2019-09-04 15:17:58 +00:00
|
|
|
# Get (cache) deps in a separate layer
|
|
|
|
COPY go.mod go.sum /go/node-feature-discovery/
|
2016-07-12 00:30:49 +00:00
|
|
|
|
2019-11-20 13:41:48 +00:00
|
|
|
WORKDIR /go/node-feature-discovery
|
2016-07-12 00:30:49 +00:00
|
|
|
|
2019-09-04 15:17:58 +00:00
|
|
|
RUN go mod download
|
|
|
|
|
|
|
|
# Do actual build
|
|
|
|
COPY . /go/node-feature-discovery
|
|
|
|
|
2020-05-19 09:21:37 +00:00
|
|
|
ARG VERSION
|
2020-05-20 16:55:54 +00:00
|
|
|
ARG HOSTMOUNT_PREFIX
|
2017-12-20 06:51:56 +00:00
|
|
|
|
2020-05-19 09:21:37 +00:00
|
|
|
RUN make install VERSION=$VERSION HOSTMOUNT_PREFIX=$HOSTMOUNT_PREFIX
|
2016-07-12 00:30:49 +00:00
|
|
|
|
2019-01-23 08:15:47 +00:00
|
|
|
RUN make test
|
2018-05-28 10:47:56 +00:00
|
|
|
|
2021-03-09 09:53:52 +00:00
|
|
|
# Create full variant of the production image
|
2021-04-20 07:42:33 +00:00
|
|
|
FROM ${BASE_IMAGE_FULL} as full
|
2021-03-09 09:53:52 +00:00
|
|
|
|
|
|
|
# Run as unprivileged user
|
|
|
|
USER 65534:65534
|
|
|
|
|
|
|
|
# Use more verbose logging of gRPC
|
|
|
|
ENV GRPC_GO_LOG_SEVERITY_LEVEL="INFO"
|
|
|
|
|
2021-03-11 17:11:08 +00:00
|
|
|
COPY --from=builder /go/node-feature-discovery/deployment/components/worker-config/nfd-worker.conf.example /etc/kubernetes/node-feature-discovery/nfd-worker.conf
|
2021-03-09 09:53:52 +00:00
|
|
|
COPY --from=builder /go/bin/* /usr/bin/
|
|
|
|
|
|
|
|
# Create minimal variant of the production image
|
2021-04-20 07:42:33 +00:00
|
|
|
FROM ${BASE_IMAGE_MINIMAL} as minimal
|
2018-05-28 10:47:56 +00:00
|
|
|
|
2020-05-28 12:10:03 +00:00
|
|
|
# Run as unprivileged user
|
|
|
|
USER 65534:65534
|
|
|
|
|
2019-02-05 19:35:51 +00:00
|
|
|
# Use more verbose logging of gRPC
|
|
|
|
ENV GRPC_GO_LOG_SEVERITY_LEVEL="INFO"
|
|
|
|
|
2021-03-11 17:11:08 +00:00
|
|
|
COPY --from=builder /go/node-feature-discovery/deployment/components/worker-config/nfd-worker.conf.example /etc/kubernetes/node-feature-discovery/nfd-worker.conf
|
2020-05-19 07:43:14 +00:00
|
|
|
COPY --from=builder /go/bin/* /usr/bin/
|