-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #851 from kubeovn/ci/base
ci: split ovn/ovs into base image
- Loading branch information
Showing
4 changed files
with
181 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Build Base | ||
on: workflow_dispatch | ||
|
||
jobs: | ||
build-amd64: | ||
name: Build AMD64 | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build | ||
run: | | ||
make base-amd64 | ||
make base-tar-amd64 | ||
- name: Upload image to artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: image-amd64 | ||
path: image-amd64.tar | ||
|
||
build-arm64: | ||
name: Build ARM64 | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
with: | ||
image: tonistiigi/binfmt:qemu-v5.2.0 | ||
platforms: arm64 | ||
|
||
- name: Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build | ||
run: | | ||
make base-arm64 || make base-arm64 | ||
make base-tar-arm64 | ||
- name: Upload image to artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: image-arm64 | ||
path: image-arm64.tar | ||
|
||
|
||
push: | ||
needs: | ||
- build-arm64 | ||
- build-amd64 | ||
name: push | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Download image | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: image-amd64 | ||
|
||
- name: Download image | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: image-arm64 | ||
|
||
- name: Load Image | ||
run: | | ||
docker load --input image-amd64.tar | ||
docker load --input image-arm64.tar | ||
- name: Push | ||
env: | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
COMMIT: ${{ github.sha }} | ||
run: | | ||
cat VERSION | ||
TAG=$(cat VERSION) | ||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||
docker images | ||
docker push kubeovn/kube-ovn-base:$TAG-amd64 | ||
docker push kubeovn/kube-ovn-base:$TAG-arm64 | ||
docker manifest create kubeovn/kube-ovn-base:$TAG kubeovn/kube-ovn-base:$TAG-amd64 kubeovn/kube-ovn-base:$TAG-arm64 | ||
docker manifest push kubeovn/kube-ovn-base:$TAG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# syntax = docker/dockerfile:experimental | ||
FROM ubuntu:20.04 as ovs-builder | ||
|
||
ARG ARCH | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
ENV SRC_DIR='/usr/src' | ||
|
||
RUN apt update && apt install build-essential git libnuma-dev autoconf curl \ | ||
python3 libmnl-dev libpcap-dev libtool libcap-ng-dev libssl-dev pkg-config \ | ||
python3-six libunbound-dev libunwind-dev dh-make fakeroot debhelper dh-python \ | ||
flake8 python3-sphinx graphviz groff -y | ||
|
||
RUN cd /usr/src/ && \ | ||
git clone -b branch-2.15 --depth=1 https://github.com/openvswitch/ovs.git && \ | ||
cd ovs && \ | ||
curl https://github.com/kubeovn/ovs/commit/df1c802f568be2af84aa81372fec46f5b09b4366.patch | git apply && \ | ||
curl https://github.com/kubeovn/ovs/commit/8dd4973bba021ce92eb9f42446d6c1c0e3474e25.patch | git apply && \ | ||
./boot.sh && \ | ||
rm -rf .git && \ | ||
DATAPATH_CONFIGURE_OPTS='--prefix=/usr --enable-shared' DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary | ||
|
||
RUN cd /usr/src/ && git clone -b branch-20.12 --depth=1 https://github.com/ovn-org/ovn.git && \ | ||
cd ovn && \ | ||
curl https://github.com/kubeovn/ovn/commit/d8253981485e499979cc47c9453b6be8eebe5f0e.patch | git apply --exclude debian/changelog && \ | ||
curl https://github.com/kubeovn/ovn/commit/e19ff25f2464e67127c7eb1edef44803aa4a5462.patch | git apply && \ | ||
curl https://github.com/kubeovn/ovn/commit/289c62e3fcd05901dac4b727aa59f6cba058905f.patch | git apply && \ | ||
curl https://github.com/kubeovn/ovn/commit/e24734913d25c0bffdf1cfd79e14ef43d01e1019.patch | git apply && \ | ||
curl https://github.com/kubeovn/ovn/commit/afb8d70fd2488631fdd71af26c6fedf78ef9309a.patch | git apply && \ | ||
curl https://github.com/kubeovn/ovn/commit/402049e21ce5fb2d0ea23c04843f49a4ab65f027.patch | git apply && \ | ||
sed -i 's/OVN/ovn/g' debian/changelog && \ | ||
rm -rf .git && \ | ||
./boot.sh && \ | ||
DATAPATH_CONFIGURE_OPTS='--prefix=/usr --with-ovs-source=/usr/src/ovs' DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary | ||
|
||
RUN mkdir /packages/ && \ | ||
cp /usr/src/libopenvswitch*.deb /packages && \ | ||
cp /usr/src/openvswitch-*.deb /packages && \ | ||
cp /usr/src/python3-openvswitch*.deb /packages && \ | ||
cp /usr/src/ovn-*.deb /packages && \ | ||
cd /packages && rm -f *dbg* *datapath* *docker* *vtep* *ipsec* *test* *dev* | ||
|
||
FROM ubuntu:20.04 | ||
|
||
RUN apt update && apt install ca-certificates python3 hostname libunwind8 netbase \ | ||
ethtool iproute2 ncat libunbound-dev procps libatomic1 kmod \ | ||
tcpdump ipset curl uuid-runtime openssl inetutils-ping \ | ||
logrotate -y --no-install-recommends && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN mkdir -p /var/run/openvswitch && \ | ||
mkdir -p /var/run/ovn && \ | ||
mkdir -p /etc/cni/net.d && \ | ||
mkdir -p /opt/cni/bin | ||
|
||
ARG ARCH | ||
ENV CNI_VERSION=v0.8.7 | ||
RUN curl -sSf -L --retry 5 https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-${ARCH}-${CNI_VERSION}.tgz | tar -xz -C . ./loopback ./portmap | ||
|
||
ENV KUBE_VERSION="v1.21.1" | ||
|
||
RUN curl -L https://dl.k8s.io/${KUBE_VERSION}/kubernetes-client-linux-${ARCH}.tar.gz | tar -xz -C . && cp ./kubernetes/client/bin/kubectl /usr/bin/kubectl \ | ||
&& chmod +x /usr/bin/kubectl && rm -rf ./kubernetes | ||
|
||
RUN --mount=type=bind,target=/packages,from=ovs-builder,source=/packages \ | ||
dpkg -i /packages/libopenvswitch*.deb && \ | ||
dpkg -i /packages/openvswitch-*.deb && \ | ||
dpkg -i /packages/python3-openvswitch*.deb &&\ | ||
dpkg -i --ignore-depends=openvswitch-switch,openvswitch-common /packages/ovn-*.deb |