-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create sample specifically for multi-arch-manifest flows
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: multi-arch image sample | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
env: | ||
GITHUB_USERNAME: baronfel | ||
APP_NAME: multi-arch-sample | ||
|
||
jobs: | ||
create-multiarch-image: | ||
permissions: | ||
contents: read | ||
packages: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Login to ghcr.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Get the code | ||
uses: actions/checkout@v2 | ||
- name: build the x64 image | ||
id: build-x64 | ||
working-directory: src/multi-arch-sample | ||
run: | | ||
dotnet publish -t:PublishContainer --arch x64 -p ContainerImageLabel=latest-x64 -p ContainerRepository=ghcr.io/${{github.repository_owner}}/${{env.APP_NAME}} | ||
echo "generated_container_name=ghcr.io/${{github.repository_owner}}/${{env.APP_NAME}}:latest-x64" >> $GITHUB_OUTPUT | ||
- name: build the arm64 image | ||
id: build-arm64 | ||
run: | | ||
dotnet publish -t:PublishContainer --arch arm64 -p ContainerImageLabel=latest-arm64 -p ContainerRepository=ghcr.io/${{github.repository_owner}}/${{env.APP_NAME}} | ||
echo "generated_container_name=ghcr.io/${{github.repository_owner}}/${{env.APP_NAME}}:latest-arm64" >> $GITHUB_OUTPUT | ||
- name: create the multi-image manifest | ||
run: | | ||
docker manifest create ghcr.io/${{github.repository_owner}}/${{env.APP_NAME}}:latest \ | ||
${{ steps.build-x64.outputs.generated_container_name }} \ | ||
${{ steps.build-arm64.outputs.generated_container_name }} \ | ||
docker manifest push ghcr.io/${{github.repository_owner}}/${{env.APP_NAME}}:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Console.WriteLine($"Hello, World from {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription} on {System.Runtime.InteropServices.RuntimeInformation.OSDescription} with {System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture} chips!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<RootNamespace>multi_arch_sample</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<EnableSdkContainerSupport>true</EnableSdkContainerSupport> | ||
</PropertyGroup> | ||
|
||
</Project> |