diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a24a64b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.*/ +build/ +Dockerfile* diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..564be33 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,46 @@ +name: Build +on: + - push +jobs: + build: + name: Build + strategy: + fail-fast: false + matrix: + include: + - image_name: debian + image_tag: 11 + - image_name: debian + image_tag: 12 + - image_name: debian + image_tag: 13 + - image_name: ubuntu + image_tag: 20.04 + - image_name: ubuntu + image_tag: 22.04 + - image_name: ubuntu + image_tag: 24.04 + - image_name: ubuntu + image_tag: 26.04 + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v6 + - name: Build + run: | + set -euxo pipefail + export DOCKER_BUILDKIT=1 + docker build \ + --progress=plain \ + --output=build \ + --target=artifacts \ + --build-arg=IMAGE=${{ matrix.image_name }}:${{ matrix.image_tag }} \ + . + for p in build/*.deb; do + mv "$p" "${p/-Linux\.deb/-${{ matrix.image_name }}-${{ matrix.image_tag }}.deb}" + done + - name: Archive + uses: actions/upload-artifact@v6 + with: + name: artifacts-${{ matrix.image_name }}-${{ matrix.image_tag }} + path: | + build/*.deb diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..be6960b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,52 @@ +ARG IMAGE=debian:13 +ARG NETWORK_NM=OFF +ARG NETWORK_CM=OFF +FROM ${IMAGE} AS build +ARG IMAGE +ENV DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC +RUN apt-get update && \ + apt-get install -y \ + cmake \ + file \ + g++ \ + git \ + python3 \ + devscripts \ + libace-dev \ + libglib2.0-dev \ + libcurl4-openssl-dev \ + libxerces-c-dev \ + libnl-3-dev \ + libnl-route-3-dev \ + libxml2-dev \ + libidn2-0-dev +COPY . /lms/ +RUN set -x && \ + cd /lms && \ + if [ "${IMAGE}" = "ubuntu:26.04" ]; then sed -i -E 's,libxml2,libxml2-16,g' CMakeLists.txt; fi && \ + mkdir build && \ + cd build && \ + cmake \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DNETWORK_NM=${NETWORK_NM} \ + -DNETWORK_CM=${NETWORK_CM} \ + .. && \ + make -j$(nproc) package && \ + ldd UNS/lms && \ + dpkg-deb --info *.deb && \ + dpkg-deb --contents *.deb + +FROM ${IMAGE} AS test +ENV DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC +RUN apt-get update && \ + apt-get install -y \ + dpkg-dev +COPY --from=build /lms/build/*.deb /test/ +RUN cd /test && \ + dpkg-scanpackages . >Packages && \ + echo 'deb [trusted=yes] file:/test ./' >/etc/apt/sources.list.d/test.list && \ + apt-get update +RUN apt-get install -y lms + +FROM scratch AS artifacts +COPY --from=test /test/*.deb /