From 6f8ba8bb19f73bb62576f96da0047f98079f0d72 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 15 Sep 2024 20:48:48 +0300 Subject: [PATCH] Introduce Debian-based Dockerfile Can be useful for building with wolfSSL, and for testing different platforms. Use it in CI to test wolfSSL. --- .github/workflows/ccpp.yml | 11 ++++++-- README.md | 20 +++++++++++-- docker/Dockerfile.debian | 58 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 docker/Dockerfile.debian diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index a7f474fc..e1c90746 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -42,9 +42,7 @@ jobs: build-static: - runs-on: ubuntu-24.04 - steps: - uses: actions/checkout@v4 - name: prepare @@ -55,3 +53,12 @@ jobs: with: name: sipp path: ./sipp + + build-wolfssl: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - name: prepare + run: git submodule update --init + - name: build-wolfssl + run: docker build -f docker/Dockerfile.debian --build-arg WOLFSSL=1 . diff --git a/README.md b/README.md index dd115724..d06d822e 100644 --- a/README.md +++ b/README.md @@ -69,8 +69,24 @@ docker build -t sipp -f docker/Dockerfile --output=. --target=bin . ``` Special arguments can be passed with `--build-arg`: -* `FULL=1` - build all optional components -* `DEBUG=1` - build with debug symbols +* `FULL=1` - build all optional components. +* `DEBUG=1` - build with debug symbols. + +## Debian-based docker build + +SIPp can be built in a Debian-based docker container. Unlike the Alpine +build, this build is not static, and it supports wolfSSL. + +To build a Debian-based docker container, run: +``` +git submodule update --init +docker build -t sipp -f docker/Dockerfile.debian . +``` + +Special arguments can be passed with `--build-arg`: +* `FULL=1` - build all optional components, including OpenSSL. +* `WOLFSSL=1` - build with wolfSSL (only works without FULL). +* `DEBUG=1` - build with debug symbols. # Support diff --git a/docker/Dockerfile.debian b/docker/Dockerfile.debian new file mode 100644 index 00000000..10c9d81e --- /dev/null +++ b/docker/Dockerfile.debian @@ -0,0 +1,58 @@ +# Usage (from within the git repo): +# git submodule update --init +# docker build -t sipp -f docker/Dockerfile . + +FROM debian:12-slim AS build + +ARG FULL='' +ARG WOLFSSL='' + +RUN --mount=type=cache,target=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt/lists \ + apt-get update && apt-get install -y --no-install-recommends \ + binutils \ + cmake \ + g++ \ + gcc \ + git \ + help2man \ + libgsl-dev \ + libpcap-dev \ + libncurses-dev \ + make \ + ninja-build \ + ${WOLFSSL:+libwolfssl-dev} \ + ${FULL:+libsctp-dev libssl-dev} + +WORKDIR /sipp +COPY CMakeLists.txt ./ +COPY src src +COPY include include +COPY gtest gtest + +ARG DEBUG='' +RUN --mount=type=bind,target=.git,source=.git \ + git config --global --add safe.directory /sipp && \ + cmake . -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DUSE_PCAP=1 \ + -DUSE_GSL=1 \ + ${DEBUG:+-DDEBUG=1} \ + ${FULL:+-DUSE_SSL=1 -DUSE_SCTP=1} \ + && ninja +RUN help2man --output=sipp.1 -v -v --no-info \ + --name='SIP testing tool and traffic generator' ./sipp + +FROM debian:12-slim +CMD ["sipp"] +ARG FULL='' +ARG WOLFSSL='' +RUN --mount=type=cache,target=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt/lists \ + apt-get update && apt-get install -y --no-install-recommends \ + libgsl27 \ + libpcap0.8 \ + libncursesw6 \ + ${WOLFSSL:+libwolfssl35} \ + ${FULL:+libsctp1 libssl3} +COPY --from=build /sipp/sipp /usr/local/bin/sipp