Skip to content

Commit

Permalink
testing ARM support
Browse files Browse the repository at this point in the history
  • Loading branch information
tenekev authored and DavidLazarescu committed Dec 29, 2023
1 parent f0da4a9 commit 89243d8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -57,14 +57,20 @@ 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
with:
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
Expand All @@ -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
Expand All @@ -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 }}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
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 . .
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
Expand Down

0 comments on commit 89243d8

Please sign in to comment.