|
| 1 | +IMAGE_NAME := gristlabs/gvisor-unprivileged:buster |
| 2 | + |
| 3 | +## usage: make <image-amd64|image-arm64|push-amd64|push-arm64|manifest|push-manifest> |
| 4 | +## |
| 5 | +## Basic targets. |
| 6 | +## |
| 7 | +## This Makefile wraps Docker commands for building and pushing multi-arch gvisor |
| 8 | +## images. As of this writing, multi-arch builds via QEMU have a conflict with |
| 9 | +## Bazel, so we have to build individual images for each architecture. The general |
| 10 | +## flow is: |
| 11 | +## |
| 12 | +## 1. Build and push images for amd64 and arm64 architectures, using the appropriate |
| 13 | +## image and push targets. The host must match the architecture of the target, so 2 |
| 14 | +## different machines must be used: one for the amd64 build, and one for the arm64 build. |
| 15 | +## 2. Once both images are published on Docker Hub, run the manifest target. This will |
| 16 | +## prepare the manifest for the final combined multi-arch image. |
| 17 | +## 3. Finally, run the push-manifest target. This will update the main multi-arch image |
| 18 | +## to contain references to the architecture-specific images built in step 1. |
| 19 | +## |
| 20 | +## Afterwards, the temporary images created in step 1 may be removed from Docker Hub |
| 21 | +## via the web interface. |
| 22 | +## |
| 23 | +help: |
| 24 | + @echo "usage: make [target]" |
| 25 | + @echo "targets: image-amd64, image-arm64, push-amd64, push-arm64, manifest, push-manifest" |
| 26 | + |
1 | 27 | default:
|
2 |
| - echo "try make image-[amd64|arm64], make push-[amd64|arm64], make manifest, or make push-manifest" |
| 28 | + help |
3 | 29 |
|
4 | 30 | image-amd64:
|
5 |
| - DOCKER_BUILDKIT=1 docker build -t gristlabs/gvisor-unprivileged:buster-amd64 . |
| 31 | + DOCKER_BUILDKIT=1 docker build -t $(IMAGE_NAME)-amd64 . |
6 | 32 |
|
7 | 33 | push-amd64:
|
8 |
| - docker push gristlabs/gvisor-unprivileged:buster-amd64 |
| 34 | + docker push $(IMAGE_NAME)-amd64 |
9 | 35 |
|
10 | 36 | image-arm64:
|
11 |
| - DOCKER_BUILDKIT=1 docker build -t gristlabs/gvisor-unprivileged:buster-arm64 . |
| 37 | + DOCKER_BUILDKIT=1 docker build -t $(IMAGE_NAME)-arm64 . |
12 | 38 |
|
13 | 39 | push-arm64:
|
14 |
| - docker push gristlabs/gvisor-unprivileged:buster-arm64 |
| 40 | + docker push $(IMAGE_NAME)-arm64 |
15 | 41 |
|
16 | 42 | manifest:
|
17 |
| - docker manifest rm gristlabs/gvisor-unprivileged:buster |
18 |
| - docker manifest create gristlabs/gvisor-unprivileged:buster \ |
19 |
| - gristlabs/gvisor-unprivileged:buster-amd64 \ |
20 |
| - gristlabs/gvisor-unprivileged:buster-arm64 |
| 43 | + docker manifest rm $(IMAGE_NAME) |
| 44 | + docker manifest create $(IMAGE_NAME) \ |
| 45 | + $(IMAGE_NAME)-amd64 \ |
| 46 | + $(IMAGE_NAME)-arm64 |
21 | 47 |
|
22 | 48 | push-manifest:
|
23 |
| - docker manifest push gristlabs/gvisor-unprivileged:buster |
24 |
| - echo "remember to delete the temporary images from Docker Hub" |
| 49 | + docker manifest push $(IMAGE_NAME) |
| 50 | + @echo "remember to delete the temporary images from Docker Hub" |
0 commit comments