Skip to content

Commit 3ba01b2

Browse files
authored
Add ImageBuilder container build instructions (#1448)
1 parent 345e070 commit 3ba01b2

File tree

2 files changed

+45
-4
lines changed

2 files changed

+45
-4
lines changed

README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
# docker-tools
2-
This is a repo to house some common tools for use in the various .NET Docker repos.
1+
# Docker Tools
2+
3+
This is a repo to house some common tools for use in the various .NET Docker repos.
4+
5+
## Image Builder
36

4-
# Image Builder
57
A tool used to build and publish Docker images.
68

79
The Image Builder tool can be acquired via a Docker image available at [mcr.microsoft.com/dotnet-buildtools/image-builder](https://mcr.microsoft.com/v2/dotnet-buildtools/image-builder/tags/list) or built from source via the [build script](./src/Microsoft.DotNet.ImageBuilder/build.ps1).
@@ -14,4 +16,4 @@ The full list of supported commands can be seen by running the tool.
1416

1517
The list of support command options can be seen by specifying the `-h` command option. The following illustrates how to list the build options.
1618

17-
- Linux container environment: `docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock mcr.microsoft.com/dotnet-buildtools/image-builder:debian-20190223173930 build -h`
19+
- Linux container environment: `docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock mcr.microsoft.com/dotnet-buildtools/image-builder:debian-20190223173930 build -h`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# ImageBuilder
2+
3+
ImageBuilder is a tool used to build and publish Docker images.
4+
5+
## Building the ImageBuilder container image
6+
7+
All commands are relative to the root of the repo.
8+
9+
### Build a single-platform image
10+
11+
Using Linux or Windows, simply run the build script:
12+
13+
```pwsh
14+
# From src/Microsoft.DotNet.ImageBuilder
15+
pwsh -f build.ps1
16+
17+
# From the root of the repo
18+
pwsh -wd ./src/Microsoft.DotNet.ImageBuilder/ -f src/Microsoft.DotNet.ImageBuilder/build.ps1
19+
```
20+
21+
### Build a multi-arch Linux image
22+
23+
If you don't need to test on Windows, this is the easiest way to create a multi-arch manifest list.
24+
25+
```pwsh
26+
# Build the image. Choose one or both platforms, and optionally push to a registry or load the image locally.
27+
docker buildx build [--push,--load] --platform [linux/amd64,linux/arm64] -t "${REPO}:${TAG}" -f .\src\Microsoft.DotNet.ImageBuilder\Dockerfile.linux .\src\Microsoft.DotNet.ImageBuilder\
28+
```
29+
30+
### Create a multi-platform manifest list
31+
32+
First, build and push Linux and Windows images separately.
33+
Gather the specific digests for the images you want to put into one manifest list.
34+
Then, create the manifest list and push it:
35+
36+
```pwsh
37+
docker manifest create "${REPO}:${TAG}" "${REPO}@sha256:abcde12345" "${REPO}@sha256:fghij67890"
38+
docker manifest push "${REPO}:${TAG}"
39+
```

0 commit comments

Comments
 (0)