This repository has been archived by the owner on May 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
51 lines (39 loc) · 2.04 KB
/
Dockerfile
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
49
50
51
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2022 Intel Corporation
# Build the manager binary
FROM golang:1.20 as builder
ARG BUILD_VERSION
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# Pull and patch netlink library
COPY 0001-adq-flower-support.patch .
COPY 0002-Support-Mark-in-the-U32-filters.patch .
RUN git clone https://github.com/vishvananda/netlink.git && cd netlink && git checkout 5e915e0149386ce3d02379ff93f4c0a5601779d5
RUN cd netlink && git apply ../0001-adq-flower-support.patch && git apply ../0002-Support-Mark-in-the-U32-filters.patch
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the go source
COPY cmd/adq-cni cmd/adq-cni
COPY cmd/adq-dp cmd/adq-dp
COPY cmd/adq-netprio cmd/adq-netprio
COPY cmd/adq-node-config cmd/adq-node-config
COPY pkg pkg
# building CNI, Device Plugin for ADQ and Prometheus exporter
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags "-X main.BuildVersion=$BUILD_VERSION" -a -o ./bin/adq-dp ./cmd/adq-dp/main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags "-X github.com/containernetworking/plugins/pkg/utils/buildversion.BuildVersion=$BUILD_VERSION" -a -o ./bin/adq-cni ./cmd/adq-cni/main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags "-X main.BuildVersion=$BUILD_VERSION" -a -o ./bin/adq-netprio ./cmd/adq-netprio/main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags "-X main.BuildVersion=$BUILD_VERSION" -a -o ./bin/adq-node-config ./cmd/adq-node-config/main.go
FROM alpine:3.15
WORKDIR /
COPY --from=builder /workspace/bin/adq-dp .
COPY --from=builder /workspace/bin/adq-cni .
COPY --from=builder /workspace/bin/adq-netprio .
COPY --from=builder /workspace/bin/adq-node-config .
RUN apk add --no-cache bash=5.1.16-r0
COPY ./deploy/k8s/entrypoint.sh /
RUN ["chmod", "+x", "/entrypoint.sh"]
USER 1001
ENTRYPOINT ["/adq-dp"]