-
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.
- Loading branch information
Showing
3 changed files
with
33 additions
and
6 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
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,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. |
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,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). |