diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 688c2aa..7b0f2d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,10 +23,17 @@ jobs: build-docker: runs-on: ubuntu-latest + strategy: + matrix: + architecture: [ amd64, arm64v8 ] steps: - name: Checkout uses: actions/checkout@v3 - name: Build things shell: pwsh run: | - docker build . + if ('${{ matrix.architecture }}' -eq 'arm64v8') { + sudo apt-get install qemu binfmt-support qemu-user-static + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + } + docker build . --build-arg ARCH=${{ matrix.architecture }} diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 325caf0..19091c3 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -78,6 +78,9 @@ jobs: create-docker-image: runs-on: ubuntu-latest needs: [ create-release ] + strategy: + matrix: + architecture: [ amd64, arm64v8 ] steps: - name: Checkout uses: actions/checkout@v3 @@ -92,6 +95,17 @@ jobs: run: | $version = '${{ github.event.ref }}'.Replace('refs/tags/', '').Replace('v', '') - docker build . --tag ghcr.io/g3rv4/getmoarfediverse:latest --tag "ghcr.io/g3rv4/getmoarfediverse:$version" - docker push ghcr.io/g3rv4/getmoarfediverse:latest - docker push "ghcr.io/g3rv4/getmoarfediverse:$version" \ No newline at end of file + if ('${{ matrix.architecture }}' -eq 'arm64v8') { + sudo apt-get install qemu binfmt-support qemu-user-static + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + } + + docker build . -t ghcr.io/g3rv4/getmoarfediverse:latest-${{ matrix.architecture }} --build-arg ARCH=${{ matrix.architecture }} + docker tag ghcr.io/g3rv4/getmoarfediverse:latest-${{ matrix.architecture }} ghcr.io/g3rv4/getmoarfediverse:$version-${{ matrix.architecture }} + docker push ghcr.io/g3rv4/getmoarfediverse:latest-${{ matrix.architecture }} + docker push ghcr.io/g3rv4/getmoarfediverse:$version-${{ matrix.architecture }} + + if ('${{ matrix.architecture }}' -eq 'amd64') { + docker tag ghcr.io/g3rv4/getmoarfediverse:latest-${{ matrix.architecture }} ghcr.io/g3rv4/getmoarfediverse:latest + docker push ghcr.io/g3rv4/getmoarfediverse:latest + } diff --git a/Dockerfile b/Dockerfile index a5692c1..f27edc4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,12 @@ # syntax=docker/dockerfile:1 -FROM mcr.microsoft.com/dotnet/sdk:6.0.403-alpine3.16 AS builder +ARG ARCH= +FROM mcr.microsoft.com/dotnet/sdk:6.0.404-alpine3.16-${ARCH} AS builder WORKDIR /src COPY src /src/ RUN dotnet publish -c Release /src/GetMoarFediverse.csproj -o /app -FROM mcr.microsoft.com/dotnet/aspnet:6.0.11-alpine3.16 +FROM mcr.microsoft.com/dotnet/aspnet:6.0.12-alpine3.16-${ARCH} VOLUME ["/data"] ENV CONFIG_PATH=/data/config.json COPY --from=builder /app /app