forked from edwarnicke/govpp
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
49 lines (41 loc) · 1.93 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
ARG VPP_VERSION=1765f014bc7fcc3b924019ec96350eb50bef629f
ARG UBUNTU_VERSION=20.04
ARG GOVPP_VERSION=v0.8.0
FROM ubuntu:${UBUNTU_VERSION} as vppbuild
ARG VPP_VERSION
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive TZ=US/Central apt-get install -y git make python3 sudo asciidoc
RUN git clone https://github.com/FDio/vpp.git
WORKDIR /vpp
RUN git checkout ${VPP_VERSION}
COPY patch/ patch/
RUN test -x "patch/patch.sh" && ./patch/patch.sh || exit 1
RUN DEBIAN_FRONTEND=noninteractive TZ=US/Central UNATTENDED=y make install-dep
RUN make pkg-deb
RUN ./src/scripts/version > /vpp/VPP_VERSION
FROM vppbuild as version
CMD cat /vpp/VPP_VERSION
FROM ubuntu:${UBUNTU_VERSION} as vppinstall
COPY --from=vppbuild /var/lib/apt/lists/* /var/lib/apt/lists/
COPY --from=vppbuild [ "/vpp/build-root/libvppinfra_*.deb", "/vpp/build-root/vpp_*.deb", "/vpp/build-root/vpp-plugin-core_*.deb", "/vpp/build-root/vpp-plugin-dpdk_*.deb", "/pkg/"]
RUN VPP_INSTALL_SKIP_SYSCTL=false apt install -f -y --no-install-recommends /pkg/*.deb ca-certificates iputils-ping iproute2 tcpdump iptables; \
rm -rf /var/lib/apt/lists/*; \
rm -rf /pkg
FROM ubuntu:${UBUNTU_VERSION} as vpp
COPY --from=vppinstall / /
FROM vpp as vpp-dbg
WORKDIR /pkg/
COPY --from=vppbuild ["/vpp/build-root/libvppinfra-dev_*.deb", "/vpp/build-root/vpp-dbg_*.deb", "/vpp/build-root/vpp-dev_*.deb", "./" ]
RUN VPP_INSTALL_SKIP_SYSCTL=false apt install -f -y --no-install-recommends ./*.deb
FROM golang:1.20.5-alpine3.18 as binapi-generator
ENV GO111MODULE=on
ENV CGO_ENABLED=0
ENV GOBIN=/bin
ARG GOVPP_VERSION
RUN go install go.fd.io/govpp/cmd/binapi-generator@${GOVPP_VERSION}
FROM alpine:3.18 as gen
COPY --from=vpp /usr/share/vpp/api/ /usr/share/vpp/api/
COPY --from=binapi-generator /bin/binapi-generator /bin/binapi-generator
COPY --from=vppbuild /vpp/VPP_VERSION /VPP_VERSION
WORKDIR /gen
CMD VPP_VERSION=$(cat /VPP_VERSION) binapi-generator --input=/usr/share/vpp/api/ ${PKGPREFIX+--import-prefix ${PKGPREFIX}}