File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build docker image
2+
3+ on :
4+ push :
5+ tags :
6+ - ' *'
7+
8+ env :
9+ PROJECT_NAME : UnityNuGet
10+ REGISTRY : ghcr.io
11+ IMAGE_NAME : ${{ github.repository }}
12+
13+ jobs :
14+ build-image :
15+ runs-on : ubuntu-latest
16+ permissions :
17+ contents : read
18+ packages : write
19+
20+ steps :
21+ - name : Checkout repository
22+ uses : actions/checkout@v3
23+
24+ - name : Set up QEMU
25+ uses : docker/setup-qemu-action@v2
26+
27+ - name : Set up Docker Buildx
28+ uses : docker/setup-buildx-action@v2
29+
30+ - name : Log in to the Container registry
31+ uses : docker/login-action@v2
32+ with :
33+ registry : ${{ env.REGISTRY }}
34+ username : ${{ github.actor }}
35+ password : ${{ secrets.GITHUB_TOKEN }}
36+
37+ - name : Extract metadata (tags, labels) for Docker
38+ id : meta
39+ uses : docker/metadata-action@v4
40+ with :
41+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
42+
43+ - name : Build and push Docker image
44+ uses : docker/build-push-action@v4
45+ with :
46+ context : .
47+ push : true
48+ platforms : linux/amd64,linux/arm64
49+ tags : ${{ steps.meta.outputs.tags }}
50+ labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change 1- FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
1+ FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0 AS build
2+ ARG TARGETARCH
23WORKDIR /app
34
45RUN mkdir -p src/UnityNuGet && mkdir -p src/UnityNuGet.Server && mkdir -p src/UnityNuGet.Tests
@@ -7,10 +8,10 @@ COPY src/*.sln src
78COPY src/UnityNuGet/*.csproj src/UnityNuGet
89COPY src/UnityNuGet.Server/*.csproj src/UnityNuGet.Server
910COPY src/UnityNuGet.Tests/*.csproj src/UnityNuGet.Tests
10- RUN dotnet restore src
11+ RUN dotnet restore src -a $TARGETARCH
1112
1213COPY . ./
13- RUN dotnet publish src -c Release -o /app/src/out
14+ RUN dotnet publish src -a $TARGETARCH - c Release -o /app/src/out
1415
1516# Build runtime image
1617FROM mcr.microsoft.com/dotnet/aspnet:7.0
You can’t perform that action at this time.
0 commit comments