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
|
2021-03-24 15:00:36 +00:00
|
|
|
FROM golang:1.16.2-buster as builder
|
2016-09-20 17:42:00 +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"
|
|
|
|
|
|
|
|
COPY --from=builder /go/node-feature-discovery/nfd-worker.conf.example /etc/kubernetes/node-feature-discovery/nfd-worker.conf
|
|
|
|
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"
|
|
|
|
|
2020-05-19 07:43:14 +00:00
|
|
|
COPY --from=builder /go/node-feature-discovery/nfd-worker.conf.example /etc/kubernetes/node-feature-discovery/nfd-worker.conf
|
|
|
|
COPY --from=builder /go/bin/* /usr/bin/
|