Skip to content

Commit

Permalink
Updated from main
Browse files Browse the repository at this point in the history
  • Loading branch information
whatever4711 committed Apr 2, 2024
2 parents 5359549 + f6e8f25 commit 445bae5
Show file tree
Hide file tree
Showing 16 changed files with 335 additions and 66 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
simple_base_images:
strategy:
matrix:
base_images: [alpine, debian]
base_images: [alpine, debian, ubuntu]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -41,7 +41,7 @@ jobs:
needs: simple_base_images
strategy:
matrix:
singlestage_images: [ab, apache, coredns, frr, ipv6, ovs, quagga, traefik, wireguard]
singlestage_images: [ab, apache, coredns, frr, ipv6, quagga, traefik, wireguard, sflowrt]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
- name: List images
run: docker image ls -a

simple_singlestage_images_debian:
simple_singlestage_images_ubuntu:
needs: simple_base_images
strategy:
matrix:
Expand All @@ -87,11 +87,11 @@ jobs:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: debian
name: ubuntu
path: /tmp
- name: Load image
run: |
docker load --input /tmp/debian.tar
docker load --input /tmp/ubuntu.tar
docker image ls -a
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand All @@ -106,7 +106,7 @@ jobs:
load: true
tags: ${{ env.REGISTRY }}/${{ matrix.singlestage_images }}:${{ env.BRANCH_NAME }}
build-args: |
image=${{ env.REGISTRY }}/debian:${{ env.BRANCH_NAME }}
image=${{ env.REGISTRY }}/ubuntu:${{ env.BRANCH_NAME }}
- name: List images
run: docker image ls -a
Expand All @@ -115,7 +115,7 @@ jobs:
needs: simple_base_images
strategy:
matrix:
multistage_images: [softether, whoami]
multistage_images: [softether, whoami, ovs]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pr-build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
base_images:
strategy:
matrix:
base_images: [alpine, debian]
base_images: [alpine, debian, ubuntu]

runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
needs: base_images
strategy:
matrix:
singlestage_images: [ab, apache, coredns, frr, ipv6, ovs, quagga, traefik, wireguard]
singlestage_images: [ab, apache, coredns, frr, ipv6, quagga, traefik, wireguard, sflowrt]
runs-on: ubuntu-latest
steps:
- name: Set time
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
with:
context: ./singlestage_images/
file: ./singlestage_images/${{ matrix.singlestage_images }}.dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand All @@ -119,7 +119,7 @@ jobs:
- name: List images
run: docker image ls

singlestage_images_debian:
singlestage_images_ubuntu:
needs: base_images
strategy:
matrix:
Expand Down Expand Up @@ -165,12 +165,12 @@ jobs:
with:
context: ./singlestage_images/
file: ./singlestage_images/${{ matrix.singlestage_images }}.dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
image=${{ env.REGISTRY }}/${{ env.REPO }}/debian:${{ env.BRANCH_NAME }}
image=${{ env.REGISTRY }}/${{ env.REPO }}/ubuntu:${{ env.BRANCH_NAME }}
- name: List images
run: docker image ls
Expand All @@ -179,7 +179,7 @@ jobs:
needs: base_images
strategy:
matrix:
multistage_images: [softether, whoami]
multistage_images: [softether, whoami, ovs]
runs-on: ubuntu-latest
steps:
- name: Set time
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/release-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
base_images:
strategy:
matrix:
base_images: [alpine, debian]
base_images: [alpine, debian, ubuntu]

runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
needs: base_images
strategy:
matrix:
singlestage_images: [ab, apache, coredns, frr, ipv6, ovs, quagga, traefik, wireguard]
singlestage_images: [ab, apache, coredns, frr, ipv6, quagga, traefik, wireguard, sflowrt]
runs-on: ubuntu-latest
steps:
- name: Set time
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
- name: List images
run: docker image ls

singlestage_images_debian:
singlestage_images_ubuntu:
needs: base_images
strategy:
matrix:
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
id: meta
uses: docker/metadata-action@v4.3.0
with:
images: unibaktr/debian
images: unibaktr/ubuntu
flavor: |
latest=false
tags: |
Expand All @@ -155,12 +155,12 @@ jobs:
with:
context: ./singlestage_images/
file: ./singlestage_images/${{ matrix.singlestage_images }}.dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
image=unibaktr/debian
image=unibaktr/ubuntu
- name: List images
run: docker image ls
Expand All @@ -169,7 +169,7 @@ jobs:
needs: base_images
strategy:
matrix:
multistage_images: [softether, whoami]
multistage_images: [softether, whoami, ovs]
runs-on: ubuntu-latest
steps:
- name: Set time
Expand Down Expand Up @@ -222,7 +222,7 @@ jobs:
needs: base_images
strategy:
matrix:
multistage_images: [onos]
multistage_images: [onos, ovs]
runs-on: ubuntu-latest
steps:
- name: Set time
Expand Down
7 changes: 4 additions & 3 deletions base_images/alpine.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ ADD ./profile/*.sh /etc/profile.d/
ADD ./profile/.bashrc /root/
ENV ENV="/etc/profile"

RUN apk add --no-cache busybox bash curl bind-tools iptables iperf dnsmasq vim nano rsync tcpdump python3 py3-pip
RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk add --no-cache busybox bash curl bind-tools iptables dnsmasq iperf vim nano rsync tcpdump python3 py3-pip parallel \
hping3@testing

RUN python3 -m pip install --no-cache-dir --upgrade pip && \
python3 -m pip install --no-cache-dir scapy
RUN python3 -m pip install --break-system-packages --no-cache-dir scapy


WORKDIR /
Expand Down
3 changes: 1 addition & 2 deletions base_images/debian.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ RUN apt-get update && apt-get install -y \
iproute2 iptables busybox dnsmasq curl vim nano rsync gpg procps iperf net-tools tcpdump traceroute iputils-ping iputils-tracepath python3 python3-pip && \
rm -rf /var/lib/apt/lists/*

RUN python3 -m pip install --no-cache-dir --upgrade pip && \
python3 -m pip install --no-cache-dir scapy
RUN python3 -m pip install --break-system-packages --no-cache-dir scapy


WORKDIR /
Expand Down
21 changes: 21 additions & 0 deletions base_images/ubuntu.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM ubuntu:jammy

ARG DEBIAN_FRONTEND="noninteractive"

ADD ./profile/*.sh /etc/profile.d/
ADD ./profile/.bashrc /root/
ENV ENV="/etc/profile"
ENV DEBIAN_FRONTEND="noninteractive"

RUN apt-get update && apt-get install -y \
iproute2 iptables busybox dnsmasq curl vim nano rsync gpg procps net-tools iperf tcpdump traceroute iputils-ping iputils-tracepath python3 python3-pip && \
rm -rf /var/lib/apt/lists/*

RUN python3 -m pip install --no-cache-dir scapy



WORKDIR /

VOLUME /hosthome
VOLUME /shared
78 changes: 63 additions & 15 deletions multistage_images/onos.dockerfile
Original file line number Diff line number Diff line change
@@ -1,42 +1,89 @@
ARG image=unibaktr/debian
FROM $image AS builder
ARG ZULU_TAG=11.0.13-11.52.13

FROM $image AS hsflow
RUN apt-get -y update && apt-get install -y --no-install-recommends \
build-essential \
git-all \
libpcap-dev \
libvirt-dev \
libnfnetlink-dev \
libxml2-dev \
libssl-dev \
libdbus-1-dev \
uuid-dev \
dmidecode
RUN mkdir /packages && chown 777 /packages
COPY onos/build_hsflowd /root/build_hsflowd
RUN chmod +x /root/build_hsflowd && \
/root/build_hsflowd


FROM azul/zulu-openjdk:${ZULU_TAG} AS builder
ARG ONOS_VERSION=2.5.9
ARG JOBS=2
ARG PROFILE=default
ARG TAG=11.0.8-11.41.23
ARG JAVA_PATH=/usr/lib/jvm/java-11-openjdk-amd64
ARG JAVA_PATH=/usr/lib/jvm/zulu11

#RUN sed -i '/stable stable-updates unstable/!s/stable stable-updates/& unstable/' /etc/apt/sources.list.d/debian.sources

#RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9 && \
# curl -sLO https://cdn.azul.com/zulu/bin/zulu-repo_${ZULU_REPO_VER}_all.deb && \
# dpkg -i zulu-repo_${ZULU_REPO_VER}_all.deb

RUN apt-get update && \
apt-get install -y ca-certificates zip python python3 git bzip2 curl unzip openjdk-11-jdk build-essential
apt-get install -y ca-certificates zip python3 git bzip2 curl unzip build-essential

RUN curl -L -o bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v1.12.0/bazelisk-linux-amd64
RUN curl -L -o bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64
RUN chmod +x bazelisk && mv bazelisk /usr/bin
RUN mkdir /src && cd /src && git clone https://gerrit.onosproject.org/onos
RUN mkdir /src && cd /src && git clone --depth 1 --branch ${ONOS_VERSION} https://gerrit.onosproject.org/onos

# Build-stage environment variables
ENV ONOS_ROOT /src/onos
ENV BUILD_NUMBER docker
ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8

WORKDIR /src/onos
WORKDIR ${ONOS_ROOT}

RUN cat WORKSPACE-docker >> WORKSPACE
RUN bazelisk build onos \
--jobs ${JOBS} \
--verbose_failures \
--javabase=@bazel_tools//tools/jdk:absolute_javabase \
--host_javabase=@bazel_tools//tools/jdk:absolute_javabase \
--define=ABSOLUTE_JAVABASE=${JAVA_PATH} \
--java_runtime_version=dockerjdk_11 \
--tool_java_runtime_version=dockerjdk_11 \
--define profile=${PROFILE}

#
RUN mkdir /output
RUN tar -xf bazel-bin/onos.tar.gz -C /output --strip-components=1

## Second and final stage is the runtime environment.
FROM $image
ARG JAVA_PATH=/usr/lib/jvm/zulu11
ARG ZULU_REPO_VER=1.0.0-3

#RUN sed -i '/stable stable-updates unstable/!s/stable stable-updates/& unstable/' /etc/apt/sources.list.d/debian.sources

RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9 && \
curl -sLO https://cdn.azul.com/zulu/bin/zulu-repo_${ZULU_REPO_VER}_all.deb && \
dpkg -i zulu-repo_${ZULU_REPO_VER}_all.deb && \
rm zulu-repo_${ZULU_REPO_VER}_all.deb

RUN apt-get update && apt-get install -y curl openjdk-11-jre openssh-server && \
RUN echo "Package: zulu11-*\nPin: version 11.0.13-*\nPin-Priority: 1001" > /etc/apt/preferences
RUN apt-get update && apt-get install -y curl zulu11-jre=11.0.13-* openssh-server supervisor dmidecode && \
rm -rf /var/lib/apt/lists/*

ADD onos/supervisord.conf /etc/supervisord.conf

COPY --from=hsflow /packages /packages

RUN dpkg -i /packages/*.deb && \
rm -rf /packages

# Install ONOS in /root/onos
COPY --from=builder /output/ /root/onos/
WORKDIR /root/onos

# Set JAVA_HOME (by default not exported by zulu images)
ARG JAVA_PATH=/usr/lib/jvm/java-11-openjdk-amd64
ENV JAVA_HOME ${JAVA_PATH}

# Ports
Expand All @@ -48,5 +95,6 @@ ENV JAVA_HOME ${JAVA_PATH}
EXPOSE 6653 6640 8181 8101 9876

# Run ONOS
ENTRYPOINT ["./bin/onos-service"]
CMD ["server"]
ENTRYPOINT /usr/bin/supervisord -c /etc/supervisord.conf
#ENTRYPOINT ["./bin/onos-service"]
#CMD ["server"]
11 changes: 11 additions & 0 deletions multistage_images/onos/build_hsflowd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
echo "build_hsflowd on platform: $1"

git clone --depth=1 https://github.com/sflow/host-sflow \
&& cd host-sflow \
&& make deb FEATURES="NFLOG PCAP TCP DOCKER KVM OVS DBUS SYSTEMD DROPMON PSAMPLE DENT CONTAINERD"

for deb in `ls *.deb`; do cp "$deb" "/packages/${deb/hsflowd/hsflowd-$1}"; done
echo ""
echo "files in /packages:"
ls -l /packages
Loading

0 comments on commit 445bae5

Please sign in to comment.