From d7b068e6944701ef0b58b7a7d669beebe1c841d4 Mon Sep 17 00:00:00 2001 From: Karl-Erik Gustafsson Date: Sun, 29 Dec 2024 12:49:09 +0200 Subject: [PATCH] chore: ubuntu 24.04 base image for test build purposes (#1854) --- .github/workflows/build-base-image-test.yml | 66 +++++++++++++++++++++ docker/Dockerfile_base_test | 28 +++++++++ 2 files changed, 94 insertions(+) create mode 100644 .github/workflows/build-base-image-test.yml create mode 100644 docker/Dockerfile_base_test diff --git a/.github/workflows/build-base-image-test.yml b/.github/workflows/build-base-image-test.yml new file mode 100644 index 000000000..744f21782 --- /dev/null +++ b/.github/workflows/build-base-image-test.yml @@ -0,0 +1,66 @@ +name: Build Docker base test image + +on: + schedule: + - cron: "0 0 * * 1" + workflow_dispatch: + +jobs: + build_docker_base_images: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: signalkci + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to ghcr.io + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GHCR_PAT }} # Personal access tokens (classic) with a scope of "write:packages" is needed to release ghcr.io package registry. + + - name: Build baseimages and push with test tag + uses: docker/build-push-action@v5 + with: + file: ./docker/Dockerfile_base_test + platforms: linux/amd64,linux/arm/v7,linux/arm64 + push: true + tags: | + signalk/signalk-server-base:test_ + ghcr.io/signalk/signalk-server-base:test_ + + - name: Modify Dockerfile_rel for testing + run: | + sed -i 's/:latest/:test_/g' ./docker/Dockerfile_rel + + - name: Build Signal K test dockers + uses: docker/build-push-action@v5 + with: + context: . + file: ./docker/Dockerfile_rel + platforms: linux/amd64,linux/arm/v7,linux/arm64 + build-args: | + TAG=latest + + - name: Push baseimages to registries with latest tag + uses: docker/build-push-action@v5 + with: + context: . + file: ./docker/Dockerfile_base_test + platforms: linux/amd64,linux/arm/v7,linux/arm64 + push: true + tags: | + signalk/signalk-server-base:testing + ghcr.io/signalk/signalk-server-base:testing \ No newline at end of file diff --git a/docker/Dockerfile_base_test b/docker/Dockerfile_base_test new file mode 100644 index 000000000..cd3463dc8 --- /dev/null +++ b/docker/Dockerfile_base_test @@ -0,0 +1,28 @@ +FROM ubuntu:24.04 + +RUN userdel -r ubuntu +RUN groupadd --gid 1000 node \ + && useradd --uid 1000 --gid node --shell /bin/bash --create-home node + +RUN DEBIAN_FRONTEND=noninteractive apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install git python3 build-essential avahi-daemon avahi-discover avahi-utils libnss-mdns mdns-scan libavahi-compat-libdnssd-dev sysstat procps nano curl libcap2-bin sudo dbus bluez\ + && groupadd -r docker -g 991 && groupadd -r i2c -g 990 && groupadd -r spi -g 989 && usermod -a -G dialout,i2c,spi,netdev,docker node + +# RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ +RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ + && DEBIAN_FRONTEND=noninteractive apt-get -y install nodejs \ + && npm config rm proxy \ + && npm config rm https-proxy \ + && npm config set fetch-retries 5 \ + && npm config set fetch-retry-mintimeout 60000 \ + && npm config set fetch-retry-maxtimeout 120000 \ + && npm cache clean -f \ + && npm install npm@latest -g \ + && sudo setcap cap_net_raw+eip $(eval readlink -f `which node`) + +COPY docker/avahi/avahi-dbus.conf /etc/dbus-1/system.d/avahi-dbus.conf +COPY docker/bluez/bluezuser.conf /etc/dbus-1/system.d/bluezuser.conf +RUN mkdir -p /var/run/dbus/ \ + && chmod -R 777 /var/run/dbus/ \ + && mkdir -p /var/run/avahi-daemon/ \ + && chmod -R 777 /var/run/avahi-daemon/ \ + && chown -R avahi:avahi /var/run/avahi-daemon/