├── .gitignore ├── hooks ├── post_push └── post_build ├── custom └── Dockerfile ├── Dockerfile ├── Makefile ├── .github └── workflows │ └── build-images.yml ├── get-vpp.sh └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.out 3 | *.log 4 | 5 | vpp/ 6 | dist/ 7 | 8 | *.deb 9 | -------------------------------------------------------------------------------- /hooks/post_push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | echo "=> Running post_push hook" 6 | 7 | VPP_VERSION=$(docker run --rm $IMAGE_NAME cat /vpp/version | cut -d~ -f1,2 | sed -e 's/~/./g') 8 | 9 | echo "Tagging the image $IMAGE_NAME with additional tag $VPP_VERSION" 10 | 11 | docker tag $IMAGE_NAME $DOCKER_REPO:$VPP_VERSION 12 | docker push $DOCKER_REPO:$VPP_VERSION 13 | -------------------------------------------------------------------------------- /custom/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | RUN apt-get update && apt-get install -y --no-install-recommends \ 4 | ca-certificates \ 5 | curl \ 6 | gnupg \ 7 | iproute2 \ 8 | iputils-ping \ 9 | && rm -rf /var/lib/apt/lists/* 10 | 11 | WORKDIR /vpp 12 | 13 | COPY *.deb ./ 14 | 15 | RUN set -eux; \ 16 | apt-get update && apt-get install -y -V ./*.deb; \ 17 | dpkg-query -f '${Version}\n' -W vpp > /vpp/version; \ 18 | rm -rf /var/lib/apt/lists/*; 19 | 20 | RUN mkdir -p /var/log/vpp 21 | 22 | CMD ["/usr/bin/vpp", "-c", "/etc/vpp/startup.conf"] 23 | -------------------------------------------------------------------------------- /hooks/post_build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | echo "=> Running post_build hook" 6 | 7 | vpp_version=$(docker run --rm $IMAGE_NAME cat /vpp/version) 8 | 9 | vpp_release=$(echo $vpp_version | cut -d~ -f1) 10 | vpp_commit=$(echo $vpp_version | sed -r 's/.*-g([0-9a-f]+).*/\1/') 11 | 12 | echo "Committing the image with additional version label $vpp_version" 13 | 14 | cid=$(docker create --rm $IMAGE_NAME) 15 | docker commit -c "LABEL io.fd.vpp.version=$vpp_version io.fd.vpp.release=$vpp_release io.fd.vpp.commit=$vpp_commit" $cid $IMAGE_NAME 16 | docker rm $cid 17 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | RUN apt-get update && apt-get install -y --no-install-recommends \ 4 | apt-transport-https \ 5 | ca-certificates \ 6 | curl \ 7 | gnupg \ 8 | iproute2 \ 9 | iputils-ping \ 10 | && rm -rf /var/lib/apt/lists/* 11 | 12 | ARG REPO 13 | ARG VPP_VERSION 14 | 15 | WORKDIR /vpp 16 | 17 | COPY get-vpp.sh /get-vpp.sh 18 | 19 | RUN set -eux; \ 20 | /get-vpp.sh; \ 21 | apt-get update && apt-get install -y -V ./*.deb; \ 22 | dpkg-query -f '${Version}\n' -W vpp > /vpp/version; \ 23 | rm -rf vom*.deb vpp-dbg*.deb; \ 24 | rm -rf /var/lib/apt/lists/*; 25 | 26 | RUN mkdir -p /var/log/vpp 27 | 28 | CMD ["/usr/bin/vpp", "-c", "/etc/vpp/startup.conf"] 29 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | REPO?=release 2 | VPP_VERSION?= 3 | 4 | DOCKER_REPO?=vpp-base 5 | TAG?=latest 6 | 7 | IMAGE_TAG=$(DOCKER_REPO):$(TAG) 8 | 9 | image: build 10 | 11 | build: 12 | @echo "# Building image: $(IMAGE_TAG)" 13 | docker build \ 14 | --build-arg REPO="$(REPO)" \ 15 | --build-arg VPP_VERSION="$(VPP_VERSION)" \ 16 | --tag $(IMAGE_TAG) \ 17 | ${DOCKER_BUILD_ARGS} . 18 | @echo "# Build OK! Image: `docker images --format '{{.Repository}}:{{.Tag}} ({{.Size}})' ${IMAGE_TAG}`" 19 | 20 | push: VPP_VERSION=$(shell docker run --rm $(IMAGE_TAG) cat /vpp/version | cut -d'~' -f1,2 | sed -e 's/~/./g') 21 | push: 22 | @echo "# Pushing image: $(IMAGE_TAG) - $(DOCKER_REPO):$(VPP_VERSION)" 23 | @curl -sSflL "https://index.docker.io/v1/repositories/$(DOCKER_REPO)/tags/$(VPP_VERSION)" || \ 24 | ( \ 25 | set -Eexu; \ 26 | docker tag "$(IMAGE_TAG)" "$(DOCKER_REPO):$(VPP_VERSION)"; \ 27 | docker push "$(DOCKER_REPO):$(VPP_VERSION)"; \ 28 | docker push "$(IMAGE_TAG)"; \ 29 | echo "# Push OK!"; \ 30 | ) 31 | 32 | .PHONY: image build push 33 | -------------------------------------------------------------------------------- /.github/workflows/build-images.yml: -------------------------------------------------------------------------------- 1 | name: Build Images 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | push: 8 | branches: 9 | - master 10 | schedule: 11 | - cron: '0 */12 * * *' 12 | workflow_dispatch: 13 | 14 | 15 | jobs: 16 | build-images: 17 | name: "VPP ${{ matrix.tag }}" 18 | runs-on: ubuntu-latest 19 | env: 20 | DOCKER_REPO: ligato/vpp-base 21 | REPO: ${{ matrix.repo }} 22 | TAG: ${{ matrix.tag }} 23 | strategy: 24 | fail-fast: false 25 | matrix: 26 | tag: ['master', 'latest', '25.10', '25.02', '24.06', '24.02'] 27 | include: 28 | - tag: 'master' 29 | repo: 'master' 30 | - tag: 'latest' 31 | repo: 'release' 32 | - tag: '25.10' 33 | repo: '2510' 34 | - tag: '25.02' 35 | repo: '2502' 36 | - tag: '24.06' 37 | repo: '2406' 38 | - tag: '24.02' 39 | repo: '2402' 40 | 41 | steps: 42 | - name: "Checkout" 43 | uses: actions/checkout@v3 44 | 45 | - name: "Build image" 46 | run: | 47 | env | sort 48 | docker build --build-arg REPO="$REPO" --tag "$DOCKER_REPO:$TAG" . 49 | docker run --rm "$DOCKER_REPO:$TAG" dpkg-query -f '${Version}' -W vpp 50 | 51 | - name: "Publish image" 52 | if: github.event_name != 'pull_request' 53 | run: | 54 | export VPP_VERSION=$(docker run --rm "$DOCKER_REPO:$TAG" cat /vpp/version | cut -d'~' -f1,2 | sed -e 's/~/./g') 55 | docker tag "$DOCKER_REPO:$TAG" "$DOCKER_REPO:$VPP_VERSION" 56 | docker images "$DOCKER_REPO" 57 | if [ $GITHUB_EVENT_NAME == "schedule" ] && curl -sSflL "https://index.docker.io/v1/repositories/$DOCKER_REPO/tags/$VPP_VERSION" >/dev/null; then 58 | echo "Image $DOCKER_REPO:$VPP_VERSION has already been published." 59 | else 60 | docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} 61 | docker push "$DOCKER_REPO:$VPP_VERSION" 62 | docker push "$DOCKER_REPO:$TAG" 63 | fi 64 | -------------------------------------------------------------------------------- /get-vpp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -z "$REPO_URL" ] && REPO_URL="https://packagecloud.io/install/repositories/fdio/${REPO:=release}" 4 | 5 | # the code below comes from FDio's CSIT project. 6 | function get_vpp () { 7 | # Get and/or install Ubuntu VPP artifacts from packagecloud.io. 8 | # 9 | # Variables read: 10 | # - REPO_URL - FD.io Packagecloud repository. 11 | # - VPP_VERSION - VPP version. 12 | # - INSTALL - If install packages or download only. Default: download 13 | 14 | ls "*.deb" 2>/dev/null && { die "remove existing *.deb files"; } 15 | 16 | set -exuo pipefail 17 | trap '' PIPE 18 | 19 | curl -sS "${REPO_URL}"/script.deb.sh | bash || { 20 | die "Packagecloud FD.io repo fetch failed." 21 | } 22 | 23 | # If version is set we will add suffix. 24 | artifacts=() 25 | both_quotes='"'"'" 26 | match="[^${both_quotes}]*" 27 | qmatch="[${both_quotes}]\?" 28 | sed_command="s#.*apt_source_path=${qmatch}\(${match}\)${qmatch}#\1#p" 29 | apt_fdio_repo_file=$(curl -s "${REPO_URL}"/script.deb.sh | \ 30 | sed -n ${sed_command}) || { 31 | die "Local fdio repo file path fetch failed." 32 | } 33 | 34 | if [ ! -f ${apt_fdio_repo_file} ]; then 35 | die "${apt_fdio_repo_file} not found, \ 36 | repository installation was not successful." 37 | fi 38 | 39 | packages=$(apt-cache -o Dir::Etc::SourceList=${apt_fdio_repo_file} \ 40 | -o Dir::Etc::SourceParts=${apt_fdio_repo_file} dumpavail \ 41 | | grep Package: | cut -d " " -f 2) || { 42 | die "Retrieval of available VPP packages failed." 43 | } 44 | if [ -z "${VPP_VERSION-}" ]; then 45 | allVersions=$(apt-cache -o Dir::Etc::SourceList=${apt_fdio_repo_file} \ 46 | -o Dir::Etc::SourceParts=${apt_fdio_repo_file} \ 47 | show vpp | grep Version: | cut -d " " -f 2) || { 48 | die "Retrieval of available VPP versions failed." 49 | } 50 | if [ "${REPO}" != "master" ]; then 51 | nonRcVersions=$(echo "$allVersions" | grep -v "\-rc[0-9]") || true 52 | [ -n "${nonRcVersions}" ] && allVersions=$nonRcVersions 53 | fi 54 | VPP_VERSION=$(echo "$allVersions" | head -n1) || true 55 | fi 56 | 57 | set +x 58 | echo "Finding packages with version: ${VPP_VERSION-}" 59 | for package in ${packages}; do 60 | # Filter packages with given version 61 | pkg_info=$(apt-cache show -- ${package}) || { 62 | die "apt-cache show on ${package} failed." 63 | } 64 | ver=$(echo ${pkg_info} | grep -o "Version: ${VPP_VERSION-}[^ ]*" | head -1) || true 65 | if [ -n "${ver-}" ]; then 66 | if [ "${package}" == "vom" ]; then 67 | echo " x '${package}' skipped" 68 | else 69 | echo "+++'${package}' found" 70 | ver=$(echo "$ver" | cut -d " " -f 2) 71 | artifacts+=(${package[@]/%/=${ver-}}) 72 | fi 73 | else 74 | echo " - '${package}'" 75 | fi 76 | done 77 | set -x 78 | 79 | if [ "${INSTALL:-false}" = true ]; then 80 | apt-get -y install "${artifacts[@]}" || { 81 | die "Install VPP artifacts failed." 82 | } 83 | else 84 | apt-get -y download "${artifacts[@]}" || { 85 | die "Download VPP artifacts failed." 86 | } 87 | fi 88 | } 89 | 90 | function die () { 91 | # Print the message to standard error end exit with error code specified 92 | # by the second argument. 93 | # 94 | # Hardcoded values: 95 | # - The default error message. 96 | # Arguments: 97 | # - ${1} - The whole error message, be sure to quote. Optional 98 | # - ${2} - the code to exit with, default: 1. 99 | 100 | set -x 101 | set +eu 102 | echo "${1:-Unspecified run-time error occurred!}" 103 | exit "${2:-1}" 104 | } 105 | 106 | get_vpp 107 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

vpp-base

2 | 3 |

4 | Workflow 5 | Latest Version 6 | Docker Pulls 7 |

8 | 9 |

The vpp-base builds docker images for VPP.

10 | 11 | --- 12 | 13 | Table of contents: 14 | - [Available Versions](#available-versions) 15 | - [Intro](#intro) 16 | - [Quickstart](#quickstart) 17 | - [Use latest release of VPP](#use-latest-release-of-vpp) 18 | - [Use development version of VPP](#use-development-version-of-vpp) 19 | - [Build Image](#build-image) 20 | - [Build with official VPP version](#build-with-official-vpp-version) 21 | - [Build with custom VPP version](#build-with-custom-vpp-version) 22 | - [Images](#images) 23 | - [Image Contents](#image-contents) 24 | - [Tag Format](#tag-format) 25 | 26 | ## Available Versions 27 | 28 | List of currently availables versions that are being maintained: 29 | 30 | | Image Tag | Packagecloud Repo | Version | Details | 31 | |---|---|---|---| 32 | |[![master](https://img.shields.io/badge/ligato/vpp--base-master-salmon.svg?logo=docker&logoColor=white&style=popout)](https://hub.docker.com/r/ligato/vpp-base/tags?name=master) | [![master](https://img.shields.io/badge/fdio-master-salmon.svg?logo=debian)](https://packagecloud.io/fdio/master) | [![version](https://img.shields.io/docker/v/ligato/vpp-base/master.svg?color=salmon)](https://img.shields.io/docker/v/ligato/vpp-base/master.svg) | ![size](https://img.shields.io/docker/image-size/ligato/vpp-base/master) | 33 | |[![latest](https://img.shields.io/badge/ligato/vpp--base-latest-brightgreen.svg?logo=docker&logoColor=white&style=popout)](https://hub.docker.com/r/ligato/vpp-base/tags?name=latest) | [![release](https://img.shields.io/badge/fdio-release-brightgreen.svg?logo=debian)](https://packagecloud.io/fdio/release) | [![version](https://img.shields.io/docker/v/ligato/vpp-base/latest.svg?color=brightgreen)](https://img.shields.io/docker/v/ligato/vpp-base/latest.svg) | ![size](https://img.shields.io/docker/image-size/ligato/vpp-base/latest) | 34 | |[![25.10](https://img.shields.io/badge/ligato/vpp--base-25.10-blue.svg?logo=docker&logoColor=white&style=popout)](https://hub.docker.com/r/ligato/vpp-base/tags?name=25.10) | [![2510](https://img.shields.io/badge/fdio-2510-37327b.svg?logo=debian)](https://packagecloud.io/fdio/2510) | [![version](https://img.shields.io/docker/v/ligato/vpp-base/25.10.svg)](https://img.shields.io/docker/v/ligato/vpp-base/25.10.svg) | ![size](https://img.shields.io/docker/image-size/ligato/vpp-base/25.10) | 35 | |[![25.02](https://img.shields.io/badge/ligato/vpp--base-25.02-blue.svg?logo=docker&logoColor=white&style=popout)](https://hub.docker.com/r/ligato/vpp-base/tags?name=25.02) | [![2502](https://img.shields.io/badge/fdio-2502-37327b.svg?logo=debian)](https://packagecloud.io/fdio/2502) | [![version](https://img.shields.io/docker/v/ligato/vpp-base/25.02.svg)](https://img.shields.io/docker/v/ligato/vpp-base/25.02.svg) | ![size](https://img.shields.io/docker/image-size/ligato/vpp-base/25.02) | 36 | |[![24.06](https://img.shields.io/badge/ligato/vpp--base-24.06-blue.svg?logo=docker&logoColor=white&style=popout)](https://hub.docker.com/r/ligato/vpp-base/tags?name=24.06) | [![2406](https://img.shields.io/badge/fdio-2406-37327b.svg?logo=debian)](https://packagecloud.io/fdio/2406) | [![version](https://img.shields.io/docker/v/ligato/vpp-base/24.06.svg)](https://img.shields.io/docker/v/ligato/vpp-base/24.06.svg) | ![size](https://img.shields.io/docker/image-size/ligato/vpp-base/24.06) | 37 | |[![24.02](https://img.shields.io/badge/ligato/vpp--base-24.02-blue.svg?logo=docker&logoColor=white&style=popout)](https://hub.docker.com/r/ligato/vpp-base/tags?name=24.02) | [![2402](https://img.shields.io/badge/fdio-2402-37327b.svg?logo=debian)](https://packagecloud.io/fdio/2402) | [![version](https://img.shields.io/docker/v/ligato/vpp-base/24.02.svg)](https://img.shields.io/docker/v/ligato/vpp-base/24.02.svg) | ![size](https://img.shields.io/docker/image-size/ligato/vpp-base/24.02) | 38 | 39 | 40 | The complete list of available image tags can be found on [DockerHub][dockerhub-tags]. 41 | 42 | ## Intro 43 | 44 | The purpose of vpp-base is to provide tools for building docker images with any version of VPP. 45 | 46 | Use cases: 47 | * Use as a base image in your Dockerfiles 48 | * Quickly test something specific VPP version 49 | * Build docker image for custom VPP builds 50 | * Generate VPP binary API bindings 51 | * Distribute Debian packages for VPP 52 | 53 | The project was created because there are no official docker images provided by the FD.io community. 54 | 55 | ## Quickstart 56 | 57 | ### Use latest release of VPP 58 | 59 | ```sh 60 | # Pull the image 61 | ➢ docker pull ligato/vpp-base 62 | 63 | # Print the VPP version 64 | ➢ docker run --rm ligato/vpp-base cat /vpp/version 65 | 20.05-release 66 | ``` 67 | 68 | ### Use development version of VPP 69 | 70 | ```sh 71 | # Pull the image 72 | ➢ docker pull ligato/vpp-base:master 73 | 74 | # Print the VPP version 75 | ➢ docker run --rm ligato/vpp-base:master cat /vpp/version 76 | 20.09-rc0~157-g8eca60df7~b1410 77 | ``` 78 | 79 | ## Build Image 80 | 81 | ### Build with official VPP version 82 | 83 | To build vpp-base image you can simply use `docker build` command (no need to clone this repository at all): 84 | 85 | ```sh 86 | # Build with latest VPP release 87 | ➢ docker build github.com/ligato/vpp-base 88 | 89 | # Build with stable VPP 20.05 90 | ➢ docker build --build-arg REPO='2005' github.com/ligato/vpp-base 91 | 92 | # Build with exact VPP version 93 | ➢ docker build --build-arg REPO='master' --build-arg VPP_VERSION='20.09-rc0~174-gbfeae8c57' github.com/ligato/vpp-base 94 | 95 | # Build with specific VPP commit 96 | ➢ docker build --build-arg REPO='master' --build-arg VPP_VERSION='20.09-rc0~[^ ]*-g' github.com/ligato/vpp-base 97 | ``` 98 | 99 | ### Build with custom VPP version 100 | 101 | To build vpp-base with custom VPP you can use the [custom](custom/Dockerfile) which installs from local debian packages by adding .deb packages from custom directory and installing them. 102 | 103 | ```sh 104 | # build VPP 105 | ( 106 | cd vpp 107 | make install-dep install-ext-deps 108 | make pkg-deb 109 | ) 110 | 111 | # copy debian packages from build-root 112 | cp ./vpp/build-root/*.deb ./custom/ 113 | 114 | # build custom vpp-base image 115 | docker build --tag vpp-base:custom ./custom 116 | ``` 117 | 118 | NOTE: You can put VPP repo into `vpp` directory at the root of this repo and it will be ignored by git. 119 | 120 | ## Images 121 | 122 | The vpp-base images are built continuously by GitHub [workflow](.github/workflows/build-images.yml) and published to DockerHub repository [ligato/vpp-base][dockerhub]. 123 | 124 | ### Image Contents 125 | 126 | The vpp-base image contains the following pieces: 127 | 128 | - **Installed VPP** ready for use with default config - `/etc/vpp/startup.conf` 129 | - **Download script** for getting VPP packages - `/get-vpp.sh` 130 | - **Debian packages** that come with VPP - `/vpp/*.deb` 131 | - **Version file** that contains VPP version - `/vpp/version` 132 | 133 | ```sh 134 | # List files in /vpp/ directory 135 | ➤ docker run --rm ligato/vpp-base:latest ls -Sgh 136 | total 11M 137 | -rw-r--r-- 1 root 3.4M Jan 29 23:02 vpp_20.01-release_amd64.deb 138 | -rw-r--r-- 1 root 3.1M Jan 29 23:02 vpp-plugin-dpdk_20.01-release_amd64.deb 139 | -rw-r--r-- 1 root 3.0M Jan 29 23:02 vpp-plugin-core_20.01-release_amd64.deb 140 | -rw-r--r-- 1 root 941K Jan 29 23:02 vpp-dev_20.01-release_amd64.deb 141 | -rw-r--r-- 1 root 166K Jan 29 23:02 libvppinfra_20.01-release_amd64.deb 142 | -rw-r--r-- 1 root 132K Jan 29 23:02 libvppinfra-dev_20.01-release_amd64.deb 143 | -rw-r--r-- 1 root 24K Jan 29 23:02 python3-vpp-api_20.01-release_amd64.deb 144 | -rw-r--r-- 1 root 24K Jan 29 23:02 vpp-api-python_20.01-release_amd64.deb 145 | -rw-r--r-- 1 root 14 Feb 7 10:14 version 146 | 147 | # Print installed VPP packages 148 | ➤ docker run --rm -i ligato/vpp-base dpkg-query -W '*vpp*' 149 | libvppinfra 20.01-release 150 | libvppinfra-dev 20.01-release 151 | python3-vpp-api 20.01-release 152 | vpp 20.01-release 153 | vpp-api-python 20.01-release 154 | vpp-dbg 20.01-release 155 | vpp-dev 20.01-release 156 | vpp-plugin-core 20.01-release 157 | vpp-plugin-dpdk 20.01-release 158 | ``` 159 | 160 | ### Tag Format 161 | 162 | Tags are derived from particular VPP version installed in the image. However they are some differences between image tag and particular VPP version: 163 | - character `~` is replaced with _dot_ `.` (not allowed in docker image tags) 164 | - build number suffix (`~bXXXX`) is omitted in tags 165 | 166 | Periodically updated images have fixed tags: 167 | - `ligato/vpp-base:latest` - latest official release 168 | - `ligato/vpp-base:master` - latest development version 169 | - `ligato/vpp-base:YY.MM` - latest stable versions 170 | 171 | All the published images are also tagged using their particular version: 172 | - `ligato/vpp-base:YY.MM-release` - official releases 173 | - `ligato/vpp-base:YY.MM-rc0.N-gabcdefg` - development versions 174 | - `ligato/vpp-base:YY.MM-rcX.N-gabcdefg` - release canditate versions 175 | - `ligato/vpp-base:YY.MM.X-N.gd28bac409` - stable versions 176 | 177 | 178 | 179 | [dockerhub]: https://hub.docker.com/r/ligato/vpp-base 180 | [dockerhub-tags]: https://hub.docker.com/r/ligato/vpp-base/tags 181 | [dockercloud-builds]: https://hub.docker.com/r/ligato/vpp-base/builds 182 | [packagecloud-fdio]: https://packagecloud.io/fdio 183 | --------------------------------------------------------------------------------