Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Commit

Permalink
README: Update build instructions
Browse files Browse the repository at this point in the history
Signed-off-by: Suraj Deshmukh <suraj@kinvolk.io>
  • Loading branch information
surajssd committed Oct 15, 2020
1 parent 5709930 commit 1ec31d1
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,22 @@ Also, another important consideration is that since a node start till the policy
is applied, the node should not be exposed. This is not covered by this
controller.

Building
========
## Building

Depending on your architecture you would use one of the commands:

### x86

```
ARCH=amd64 docker build -t quay.io/kinvolk/calico-hostendpoint-controller:v0.0.4-amd64 \
--build-arg ARCH . && docker push quay.io/kinvolk/calico-hostendpoint-controller:v0.0.4-amd64
```

### arm

```
ARCH=amd64 docker build -t kinvolk/calico-hostendpoint-controller:v0.0.2-amd64 --build-arg ARCH . && docker push kinvolk/calico-hostendpoint-controller:v0.0.2-amd64
ARCH=arm64 docker build -t kinvolk/calico-hostendpoint-controller:v0.0.2-arm64 --build-arg ARCH . && docker push kinvolk/calico-hostendpoint-controller:v0.0.2-arm64
ARCH=arm64 docker build -t quay.io/kinvolk/calico-hostendpoint-controller:v0.0.4-arm64 \
--build-arg ARCH . && docker push quay.io/kinvolk/calico-hostendpoint-controller:v0.0.4-arm64
```

There are multiple ways for building an image for another architecture which is
Expand All @@ -25,7 +33,7 @@ The most convenient one is to install the `qemu-user-static` package on your
system to set up binary translation so that the Linux kernel can run binaries
for other architectures.

>NOTE: You may have to run `sudo systemctl restart systemd-binfmt.service` after installing.
> **NOTE**: You may have to run `sudo systemctl restart systemd-binfmt.service` after installing.
The downside of this approach is that a base image for the non-native
architecture must be explicitly specified in the `FROM` directive of the
Expand All @@ -36,6 +44,8 @@ need to use `arm64v8/debian:9` (prefixed because there is no `debian:9-arm64`).
When done building, you can change the Dockerfile back to the way it was
before. Unfortunately the `FROM` directive does not handle build arguments.

### Combined image tag

Now make sure you have `"experimental": "enabled"` in your
`~/.docker/config.json` (surrounded by `{` and `}` if the file is otherwise
empty).
Expand All @@ -44,8 +54,17 @@ When all images are built on the respective architectures and pushed they can
be combined through a manifest to build a multiarch image:

```
docker manifest create kinvolk/calico-hostendpoint-controller:v0.0.2 --amend kinvolk/calico-hostendpoint-controller:v0.0.2-amd64 --amend kinvolk/calico-hostendpoint-controller:v0.0.2-arm64
docker manifest annotate kinvolk/calico-hostendpoint-controller:v0.0.2 kinvolk/calico-hostendpoint-controller:v0.0.2-amd64 --arch=amd64 --os=linux
docker manifest annotate kinvolk/calico-hostendpoint-controller:v0.0.2 kinvolk/calico-hostendpoint-controller:v0.0.2-arm64 --arch=arm64 --os=linux
docker manifest push kinvolk/calico-hostendpoint-controller:v0.0.2
docker manifest create quay.io/kinvolk/calico-hostendpoint-controller:v0.0.4 \
--amend quay.io/kinvolk/calico-hostendpoint-controller:v0.0.4-amd64 \
--amend quay.io/kinvolk/calico-hostendpoint-controller:v0.0.4-arm64
docker manifest annotate quay.io/kinvolk/calico-hostendpoint-controller:v0.0.4 \
quay.io/kinvolk/calico-hostendpoint-controller:v0.0.4-amd64 --arch=amd64 --os=linux
docker manifest annotate quay.io/kinvolk/calico-hostendpoint-controller:v0.0.4 \
quay.io/kinvolk/calico-hostendpoint-controller:v0.0.4-arm64 --arch=arm64 --os=linux
docker manifest push quay.io/kinvolk/calico-hostendpoint-controller:v0.0.4
```

> **NOTE**: Above commands can be run from any machine.

0 comments on commit 1ec31d1

Please sign in to comment.