Skip to content

Commit 43634e9

Browse files
committed
feat: add custodian base image Dockerfile
1 parent 873c8d4 commit 43634e9

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

Diff for: deploy/custodian/Dockerfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM alpine/helm:3.11.3
2+
3+
LABEL org.opencontainers.image.source https://github.com/project-codeflare/codeflare-cli
4+
5+
RUN if [[ $(uname -m) = aarch64 ]]; then KUBECTL_ARCH=arm64; else KUBECTL_ARCH=amd64; fi; curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/$KUBECTL_ARCH/kubectl" && \
6+
chmod a+rx kubectl && \
7+
mv kubectl /usr/local/bin
8+
9+
ENTRYPOINT bash

Diff for: deploy/custodian/README.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Guide for building multi-arch docker images
2+
3+
## Creating a `docker buildx` build config
4+
5+
To build for both amd64 and aarch4 (e.g. for running on Apple
6+
Silicon), you can use `docker buildx`.
7+
8+
First, you will need to create a buildx config, because the default
9+
one does not seem to work well for cross-platform builds. Here we name
10+
that config `multiarch`, but it can be named anything.
11+
12+
We have found that using the `kubernetes` driver works better than the
13+
default `docker-container` driver.
14+
15+
```shell
16+
docker buildx create --name multiarch --use --driver kubernetes --driver-opt=qemu.install=true
17+
```
18+
19+
The `--use` part tells buildx to set this as the default builder.
20+
21+
_Note_: We tell docker buildx to use qemu, so that the amd64 images
22+
can be built on an aarch64 host.
23+
24+
_Warning_: If your KUBECONFIG env var is colon-separated, this is
25+
something that `docker buildx` apparently does not support. You will
26+
need to run any `docker buildx` commands with
27+
e.g. `KUBECONFIG=~/.kube/config`, i.e. pointing it to a single
28+
filepath.
29+
30+
## Starting a build
31+
32+
Now you should be able to build and push:
33+
34+
```shell
35+
# whatever you need here, but note that the Dockerfiles
36+
# may need to change, as you update these image names and tags
37+
TAG=ghcr.io/project-codeflare/custodian:0.0.1
38+
39+
# build for aarch64 (arm64/v8) and amd64
40+
PLATFORMS=linux/arm64/v8,linux/amd64
41+
42+
# note here that we build and push in one step; for some reason,
43+
# buildx fails when only building
44+
docker buildx build --push --platforms $PLATFORMS --tag $TAG .
45+
```

0 commit comments

Comments
 (0)