diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fc9cea58..32a88f4b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,42 @@ on: branches: [ "master" ] jobs: + docker: + + strategy: + matrix: + ubuntu: [22.04, 20.04] + libgtk: [libgtk-3-dev, libgtk2.0-dev] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: dorny/paths-filter@v2 + id: changes + with: + filters: | + docker: + - 'docker/**' + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: "{{defaultContext}}:docker/build" + push: true + tags: ghcr.io/viking-gps/viking-build-env:${{ matrix.ubuntu }}-${{ matrix.libgtk }} + if: steps.changes.outputs.docker == 'true' + build: + if: ${{ always() }} + needs: docker strategy: fail-fast: false @@ -14,15 +49,13 @@ jobs: os: [ubuntu-22.04, ubuntu-20.04] libgtk: [libgtk-3-dev, libgtk2.0-dev] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest + container: + image: ghcr.io/viking-gps/viking-build-env:${{ matrix.ubuntu }}-${{ matrix.libgtk }} steps: - uses: actions/checkout@v3 - - name: "Install requirements" - run: sudo apt-get install gtk-doc-tools docbook-xsl yelp-tools libpng-dev ${{ matrix.libgtk }} libicu-dev libjson-glib-dev intltool autopoint xxd libcurl4-gnutls-dev libglib2.0-dev-bin libsqlite3-dev nettle-dev libmapnik-dev libgeoclue-2-dev libgexiv2-dev libgps-dev libmagic-dev libbz2-dev libzip-dev liboauth-dev libnova-dev - shell: bash - - name: Prepare run: ./autogen.sh ${{ matrix.libgtk == 'libgtk2.0-dev' && '--enable-gtk2' }} diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile new file mode 100644 index 00000000..86253c7e --- /dev/null +++ b/docker/build/Dockerfile @@ -0,0 +1,10 @@ +ARG UBUNTU_VERSION=22.04 + +FROM ubuntu:$UBUNTU_VERSION + +ARG LIBGTK=libgtk-3-dev + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt update && \ + apt install -y gtk-doc-tools docbook-xsl yelp-tools libpng-dev $LIBGTK libicu-dev libjson-glib-dev intltool autopoint xxd libcurl4-gnutls-dev libglib2.0-dev-bin libsqlite3-dev nettle-dev libmapnik-dev libgeoclue-2-dev libgexiv2-dev libgps-dev libmagic-dev libbz2-dev libzip-dev liboauth-dev libnova-dev && \ + rm -rf /var/lib/apt/lists/* diff --git a/docker/build/Makefile b/docker/build/Makefile new file mode 100644 index 00000000..72bb5fba --- /dev/null +++ b/docker/build/Makefile @@ -0,0 +1,18 @@ +all: \ + ubuntu2004-gtk3 \ + ubuntu2004-gtk2 \ + ubuntu2204-gtk3 \ + ubuntu2204-gtk2 + +ubuntu2004-gtk3: + docker build --build-arg UBUNTU_VERSION=20.04 --build-arg LIBGTK=libgtk-3-dev -t viking-build:$@ . + +ubuntu2004-gtk2: + docker build --build-arg UBUNTU_VERSION=20.04 --build-arg LIBGTK=libgtk2.0-dev -t viking-build:$@ . + +ubuntu2204-gtk3: + docker build --build-arg UBUNTU_VERSION=22.04 --build-arg LIBGTK=libgtk-3-dev -t viking-build:$@ . + +ubuntu2204-gtk2: + docker build --build-arg UBUNTU_VERSION=22.04 --build-arg LIBGTK=libgtk2.0-dev -t viking-build:$@ . + \ No newline at end of file