Create an ARM docker image as well (#29)

This commit is contained in:
Gervasio Marchand 2022-12-25 12:50:58 -08:00 committed by GitHub
parent 92e34f7086
commit 6431c9505f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 6 deletions

View File

@ -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 }}

View File

@ -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"
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
}

View File

@ -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