From 89243d85783919f8f546a22267869e62e6faf415 Mon Sep 17 00:00:00 2001 From: Radoslav Date: Fri, 29 Dec 2023 18:42:18 +0000 Subject: [PATCH] testing ARM support --- .github/workflows/docker.yml | 18 ++++++++++++------ Dockerfile | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 157f428..247eedf 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -29,8 +29,8 @@ jobs: file: "Dockerfile" image: "librum-server" # ARM not working. Needs further research. - # platforms: "linux/arm64,linux/amd64" - platforms: "linux/amd64" + platforms: "linux/arm64,linux/amd64" + #platforms: "linux/amd64" steps: - name: Checkout @@ -57,6 +57,12 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Sanitize unfortunate names + id: sanitize_names + uses: ASzc/change-string-case-action@v5 + with: + string: ${{ github.repository_owner }} + - name: Generate docker image tags id: metadata uses: docker/metadata-action@v5 @@ -64,7 +70,7 @@ jobs: flavor: | latest=true images: | - name=ghcr.io/${{ github.repository_owner }}/${{matrix.image}} + name=ghcr.io/${{ steps.sanitize_names.outputs.lowercase }}/${{matrix.image}} tags: | # Tag with branch name type=ref,event=branch @@ -81,7 +87,7 @@ jobs: # Essentially just ignore the cache output (PR can't write to registry cache) echo "cache-to=type=local,dest=/tmp/discard,ignore-error=true" >> $GITHUB_OUTPUT else - echo "cache-to=type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/librum-build-cache:${{ matrix.image }}" >> $GITHUB_OUTPUT + echo "cache-to=type=registry,mode=max,ref=ghcr.io/${{ steps.sanitize_names.outputs.lowercase }}/librum-build-cache:${{ matrix.image }}" >> $GITHUB_OUTPUT fi - name: Build and push image @@ -92,7 +98,7 @@ jobs: platforms: ${{ matrix.platforms }} # Skip pushing when PR from a fork push: ${{ !github.event.pull_request.head.repo.fork }} - cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/librum-build-cache:${{matrix.image}} + cache-from: type=registry,ref=ghcr.io/${{ steps.sanitize_names.outputs.lowercase }}/librum-build-cache:${{matrix.image}} cache-to: ${{ steps.cache-target.outputs.cache-to }} tags: ${{ steps.metadata.outputs.tags }} - labels: ${{ steps.metadata.outputs.labels }} + labels: ${{ steps.metadata.outputs.labels }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5d2b83b..263b421 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /app COPY . . @@ -6,7 +6,7 @@ RUN dotnet restore && \ cd src/Presentation && \ dotnet publish -c Release -o build --no-restore --verbosity m -FROM mcr.microsoft.com/dotnet/aspnet:8.0 +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0 WORKDIR /var/lib/librum-server/ RUN groupadd -r -f librum-server