diff --git a/.github/workflows/aot.yml b/.github/workflows/aot.yml index 0ad0b76..b755ee5 100644 --- a/.github/workflows/aot.yml +++ b/.github/workflows/aot.yml @@ -34,10 +34,11 @@ jobs: runtimeflavor: alpine arch: amd64 installcommand: 'true' - - sdkflavor: alpine-aot-arm64v8 - runtimeflavor: alpine - arch: arm64 - installcommand: 'true' + # arm64 emulation is flaky for alpine so we will skip this for now + # - sdkflavor: alpine-aot-arm64v8 + # runtimeflavor: alpine + # arch: arm64 + # installcommand: 'true' name: "${{ matrix.sdkflavor }} => ${{ matrix.runtimeflavor }}-${{ matrix.arch }}" runs-on: ubuntu-latest @@ -102,7 +103,6 @@ jobs: docker manifest create ghcr.io/${{github.repository_owner}}/aot-sample:latest \ ghcr.io/${{github.repository_owner}}/aot-sample:jammy-chiseled-amd64 \ ghcr.io/${{github.repository_owner}}/aot-sample:jammy-chiseled-arm64 \ - ghcr.io/${{github.repository_owner}}/aot-sample:alpine-amd64 \ - ghcr.io/${{github.repository_owner}}/aot-sample:alpine-arm64 + ghcr.io/${{github.repository_owner}}/aot-sample:alpine-amd64 docker manifest push ghcr.io/${{github.repository_owner}}/aot-sample:latest diff --git a/src/aot-sample/README.md b/src/aot-sample/README.md index e69de29..0212208 100644 --- a/src/aot-sample/README.md +++ b/src/aot-sample/README.md @@ -0,0 +1,16 @@ +# Ahead-of-time (AOT) compilation and containerization + +This sample shows how an AOT-compiled console application could be containerized using the .NET SDK. This application is compiled for 4 OS/architecture combinations: + +* Ubuntu x64 +* Ubuntu ARM64 +* Alpine x64 +* Alpine ARM64 (note: in GitHub Actions this requires emulation - this is often flaky so it's been commented out of the workflow) + +The various images are also combined into one 'multi-architecture' image so that the correct image is used for the host on which the container is running. + +The sample includes: +* a simple [.NET Console application](./Program.cs) that echoes out the OS and architecture information when run +* a [GitHub Actions workflow](../../.github/workflows/aot.yml) showing how to combine the 4 architecture-specific images into a single multi-architecture image + +This scenario is especially tricky because AOT compilation generally requires performing the publish on an OS and architecture that matches the target. This sample shows how to use the .NET SDK to build the AOT-compiled application for each target and then use the Docker CLI to combine them into a single image. Take note in the workflow how the actual image is published using the `mcr.microsoft.com/dotnet/sdk` container for that platform, but the generated image is pushed to an external registry for use later in the workflow. diff --git a/src/multi-arch-sample/README.md b/src/multi-arch-sample/README.md new file mode 100644 index 0000000..9aea3b6 --- /dev/null +++ b/src/multi-arch-sample/README.md @@ -0,0 +1,11 @@ +# Multi-architecture containers + +This sample illustrates how you can use a combination of the .NET SDK and the Docker CLI to create +multi-architecture container images. These images will automatically use the correct architecture +for the host on which they are running. + +The sample includes: +* a simple [.NET Console application](./Program.cs) that echoes out the OS and architecture information when run +* a [GitHub Actions workflow](../../.github/workflows/multi-arch-sample.yml) showing how to combine two architecture-specific images into a single multi-architecture image + +This example currently has to use both the .NET CLI and a container CLI to create multi-image manifests because the .NET CLI doesn't natively know how to create multi-architecture images. If you'd use this functionality in the .NET CLI, please [+1 or comment on the tracking issue](https://github.com/dotnet/sdk-container-builds/issues/87). \ No newline at end of file