diff --git a/.github/workflows/CI_CD.yml b/.github/workflows/CI_CD.yml index 0921623..4728749 100644 --- a/.github/workflows/CI_CD.yml +++ b/.github/workflows/CI_CD.yml @@ -53,7 +53,6 @@ jobs: run: dotnet test --no-build --filter "TestCategory=System|TestCategory=Performance" - name: Login to DockerHub uses: docker/login-action@v3 - if: ${{ env.IS_RELEASE == 'true' }} with: registry: registry.hub.docker.com username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -61,8 +60,8 @@ jobs: - name: Build Docker if: ${{ env.IS_RELEASE != 'true' }} run: | - dotnet publish src/ScreenshotCreator.Api/ScreenshotCreator.Api.csproj --os linux --arch arm64 /t:PublishContainer '-p:ContainerImageTags="dev"' + dotnet publish src/ScreenshotCreator.Api/ScreenshotCreator.Api.csproj /t:MultiArchPublish '-p:ContainerImageTags="dev"' -p:ContainerRegistry=registry.hub.docker.com - name: Push Docker if: ${{ env.IS_RELEASE == 'true' }} run: | - dotnet publish src/ScreenshotCreator.Api/ScreenshotCreator.Api.csproj --os linux --arch arm64 /t:PublishContainer '-p:ContainerImageTags="${{ env.VERSION }};latest"' -p:ContainerRegistry=registry.hub.docker.com \ No newline at end of file + dotnet publish src/ScreenshotCreator.Api/ScreenshotCreator.Api.csproj /t:MultiArchPublish '-p:ContainerImageTags="${{ env.VERSION }};latest"' -p:ContainerRegistry=registry.hub.docker.com \ No newline at end of file diff --git a/src/ScreenshotCreator.Api/ScreenshotCreator.Api.csproj b/src/ScreenshotCreator.Api/ScreenshotCreator.Api.csproj index a6b9d3d..9f45964 100644 --- a/src/ScreenshotCreator.Api/ScreenshotCreator.Api.csproj +++ b/src/ScreenshotCreator.Api/ScreenshotCreator.Api.csproj @@ -21,4 +21,109 @@ + + + + linux-x64;linux-arm64 + + + + + + + + + <_rids Include="$(RuntimeIdentifiers)"/> + <_InnerBuild Include="$(MSBuildProjectFullPath)" + AdditionalProperties="RuntimeIdentifier=%(_rids.Identity)" + PropertiesToUnset="RuntimeIdentifiers"/> + + + + + + + + + + + + + + <_TagsToPublish Include="$(ContainerImageTags)"/> + + + <_RIDItems Include="linux-x64" GolangArch="amd64"/> + <_RIDItems Include="linux-arm64" GolangArch="arm64"/> + + + + + + + + + <_RIDSForTag Include="@(_TagsToPublish)" RID="%(_RIDItems.Identity)" GolangArch="%(_RIDItems.GolangArch)"/> + <_TagsForRID Include="%(_RIDSForTag.RID)" ContainerTags="@(_RIDSForTag->'%(Identity)-%(GolangArch)', ';')"/> + + + <_ContainerPublish + Include="$(MSBuildProjectFullPath)" + AdditionalProperties="RuntimeIdentifier=%(_TagsForRID.Identity);ContainerImageTags=%(_TagsForRID.ContainerTags)"/> + + + + + + + + + + + + + + + <_RIDSForTag> + $(ContainerRegistry)/$(ContainerRepository):%(Identity)-%(GolangArch) + $(ContainerRegistry)/$(ContainerRepository):%(Identity) + + + + + + + + \ No newline at end of file