server multiarch build.

This commit is contained in:
Miroslav Šedivý 2025-02-23 15:37:07 +01:00
parent 9d1d30fc6b
commit 8e97a97f79
6 changed files with 75 additions and 99 deletions

View file

@ -1,44 +1,64 @@
name: Create and publish a Docker image name: Build and Publish Server Artifacts
on: workflow_dispatch on:
# push: pull_request:
# branches: branches:
# - 'master' - master
# tags:
# - 'v*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs: jobs:
build-and-push-image: server_build:
name: Build and Publish Server Artifacts
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: strategy:
contents: read matrix:
packages: write arch:
- name: amd64
platform: linux/amd64
- name: arm64
platform: linux/arm64
- name: armv7
platform: linux/arm/v7
variant:
- name: bullseye
dockerfile: Dockerfile
- name: bookworm
dockerfile: Dockerfile.bookworm
env:
ARTIFACT_NAME: ${{ matrix.arch.name }}-${{ matrix.variant.name }}-server
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with: with:
registry: ${{ env.REGISTRY }} fetch-depth: 0
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker - name: Set up QEMU
id: meta uses: docker/setup-qemu-action@v3
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image - name: Set up Docker Buildx
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc uses: docker/setup-buildx-action@v3
- name: Build Docker image
id: build
uses: docker/build-push-action@v6
with: with:
context: ./server/ context: ./server/
push: true file: ./server/${{ matrix.variant.dockerfile }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ env.ARTIFACT_NAME }}
labels: ${{ steps.meta.outputs.labels }} platforms: ${{ matrix.arch.platform }}
load: true
outputs: type=docker
- name: Copy artifacts
run: |
container_id=$(docker create ${{ env.ARTIFACT_NAME }})
mkdir -p artifacts/${{ matrix.arch.name }}-${{ matrix.variant.name }}
docker cp $container_id:/src/bin/. artifacts/${{ matrix.arch.name }}-${{ matrix.variant.name }}/
docker rm $container_id
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: artifacts/${{ matrix.arch.name }}-${{ matrix.variant.name }}

View file

@ -1,53 +0,0 @@
name: Create and publish a Docker image variant
on: workflow_dispatch
# push:
# tags:
# - 'v*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image-variant:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- variant: bookworm
dockerfile: Dockerfile.bookworm
- variant: nvidia
dockerfile: Dockerfile.nvidia
- variant: nvidia_bookworm
dockerfile: Dockerfile.nvidia.bookworm
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.variant }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./server/
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View file

@ -13,7 +13,7 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN set -eux; \ RUN set -eux; \
apt-get update; \ apt-get update; \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
wget ca-certificates supervisor \ wget ca-certificates python2 supervisor \
pulseaudio dbus-x11 xserver-xorg-video-dummy \ pulseaudio dbus-x11 xserver-xorg-video-dummy \
libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libvpx6 \ libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libvpx6 \
# #
@ -26,11 +26,13 @@ RUN set -eux; \
# gst # gst
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \ gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \ gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
gstreamer1.0-pulseaudio; \ gstreamer1.0-pulseaudio gstreamer1.0-omx; \
#
# install libxcvt0 (not available in debian:bullseye) # install libxcvt0 (not available in debian:bullseye)
wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt0_0.1.2-1_amd64.deb; \ ARCH=$(dpkg --print-architecture); \
apt-get install --no-install-recommends ./libxcvt0_0.1.2-1_amd64.deb; \ wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt0_0.1.2-1_${ARCH}.deb; \
rm ./libxcvt0_0.1.2-1_amd64.deb; \ apt-get install --no-install-recommends ./libxcvt0_0.1.2-1_${ARCH}.deb; \
rm ./libxcvt0_0.1.2-1_${ARCH}.deb; \
# #
# create a non-root user # create a non-root user
groupadd --gid $USER_GID $USERNAME; \ groupadd --gid $USER_GID $USERNAME; \

View file

@ -35,10 +35,12 @@ RUN set -eux; \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \ gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \ gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
gstreamer1.0-pulseaudio gstreamer1.0-vaapi; \ gstreamer1.0-pulseaudio gstreamer1.0-vaapi; \
#
# install libxcvt0 (not available in debian:bullseye) # install libxcvt0 (not available in debian:bullseye)
wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt0_0.1.2-1_amd64.deb; \ ARCH=$(dpkg --print-architecture); \
apt-get install --no-install-recommends ./libxcvt0_0.1.2-1_amd64.deb; \ wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt0_0.1.2-1_${ARCH}.deb; \
rm ./libxcvt0_0.1.2-1_amd64.deb; \ apt-get install --no-install-recommends ./libxcvt0_0.1.2-1_${ARCH}.deb; \
rm ./libxcvt0_0.1.2-1_${ARCH}.deb; \
# #
# create a non-root user # create a non-root user
groupadd --gid $USER_GID $USERNAME; \ groupadd --gid $USER_GID $USERNAME; \

View file

@ -135,10 +135,12 @@ RUN set -eux; \
# #
# file chooser handler, clipboard, drop # file chooser handler, clipboard, drop
xdotool xclip libgtk-3-0; \ xdotool xclip libgtk-3-0; \
#
# install libxcvt0 (not available in debian:bullseye) # install libxcvt0 (not available in debian:bullseye)
wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt0_0.1.2-1_amd64.deb; \ ARCH=$(dpkg --print-architecture); \
apt-get install --no-install-recommends ./libxcvt0_0.1.2-1_amd64.deb; \ wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt0_0.1.2-1_${ARCH}.deb; \
rm ./libxcvt0_0.1.2-1_amd64.deb; \ apt-get install --no-install-recommends ./libxcvt0_0.1.2-1_${ARCH}.deb; \
rm ./libxcvt0_0.1.2-1_${ARCH}.deb; \
# #
# create a non-root user # create a non-root user
groupadd --gid $USER_GID $USERNAME; \ groupadd --gid $USER_GID $USERNAME; \

View file

@ -11,10 +11,13 @@ RUN set -eux; \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
libx11-dev libxrandr-dev libxtst-dev libgtk-3-dev \ libx11-dev libxrandr-dev libxtst-dev libgtk-3-dev \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev; \ libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev; \
#
# install libxcvt-dev (not available in debian:bullseye) # install libxcvt-dev (not available in debian:bullseye)
wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt-dev_0.1.2-1_amd64.deb; \ ARCH=$(dpkg --print-architecture); \
wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt0_0.1.2-1_amd64.deb; \ wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt-dev_0.1.2-1_${ARCH}.deb; \
apt-get install --no-install-recommends ./libxcvt0_0.1.2-1_amd64.deb ./libxcvt-dev_0.1.2-1_amd64.deb; \ wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt0_0.1.2-1_${ARCH}.deb; \
apt-get install --no-install-recommends ./libxcvt0_0.1.2-1_${ARCH}.deb ./libxcvt-dev_0.1.2-1_${ARCH}.deb; \
rm ./libxcvt0_0.1.2-1_${ARCH}.deb ./libxcvt-dev_0.1.2-1_${ARCH}.deb; \
# #
# clean up # clean up
apt-get clean -y; \ apt-get clean -y; \