Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit 490f430

Browse files
Document dotnet Linux ARM64 image build and test (#1207)
1 parent ca17a38 commit 490f430

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

build/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,3 +692,47 @@ After everything builds successfully, the packaging process kicks off and perfor
692692
📄 devcontainer.json
693693
📄 Dockerfile
694694
```
695+
696+
## Linux ARM64 Specific Builds
697+
698+
The below provides a mechanism to build and test against targeted platforms (e.g. Linux ARM64). The following example uses the the dotnet container image for reference.
699+
700+
### Build
701+
702+
Run the docker build command using `buildx` from the .devcontainer in the dotnet directory within the project repo (`containers/dotnet/.devcontainer`). [buildx](https://docs.docker.com/buildx/working-with-buildx/) is a Docker CLI plugin that provides the ability to target multi-architectures (e.g. ARM64).
703+
704+
Note a few of the arguments:
705+
706+
- `--platform`: specifies the architecture to target, in this case we will be targeting Linux ARM64
707+
- `--build-arg`: for this example, we will be targeting specific dotnet versions (e.g. 6.0, 5.0, and 3.1) and Linux versions and distros.
708+
709+
```bash
710+
docker buildx build --build-arg VARIANT=6.0.100-bullseye-slim-arm64v8 --platform linux/arm64 -t dotnet-arm64 --load -f base.Dockerfile .
711+
```
712+
713+
Once the build is complete, run the image using the below example. Note that the dotnet directory is mounted. The dotnet directory includes test scripts which will be used in the subsequent steps.
714+
715+
```bash
716+
docker run -v $REPODIR/vscode-dev-containers/containers/dotnet/:/workspace --platform linux/arm64 -it dotnet-arm64 bash
717+
```
718+
719+
Once in the running container, verify that the architecture is ARM64 by running the command:
720+
721+
```bash
722+
uname -m
723+
```
724+
725+
For ARM64 on Linux, the architecture will show as `aarch64`.
726+
727+
### Test
728+
729+
For Linux ARM64 and the Dotnet container requires that [VS Code attaches](https://code.visualstudio.com/docs/remote/attach-container) to the running container instance. Using VS Code and the [Remote-Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers), attach to the running instance of the image previously created, run the test script and they should all pass.
730+
731+
```bash
732+
/workspace/test-project/test.sh
733+
```
734+
735+
### Reference
736+
737+
- [ARM documentation](https://developer.arm.com/documentation/102475/0100/Multi-architecture-images) for how to build multi-architecture images.
738+
- [List of Supported Linux ARM64 DotNet SDK Images](https://hub.docker.com/_/microsoft-dotnet-sdk)

0 commit comments

Comments
 (0)