Version 3 - Phase 1 #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish Server Artifacts | |
on: | |
pull_request: | |
branches: | |
- master | |
paths: | |
- server/** | |
jobs: | |
server_build: | |
name: Build and Publish Server Artifacts | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
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 | |
fail-fast: false | |
env: | |
ARTIFACT_NAME: ${{ matrix.arch.name }}-${{ matrix.variant.name }}-server | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
# Temporary hotfix for the setup-qemu-action | |
# Ref: https://github.com/tonistiigi/binfmt/issues/240 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
image: tonistiigi/binfmt:qemu-v7.0.0-28 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker image | |
id: build | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./server/ | |
file: ./server/${{ matrix.variant.dockerfile }} | |
tags: ${{ env.ARTIFACT_NAME }} | |
platforms: ${{ matrix.arch.platform }} | |
load: true | |
- 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 }} |