Skip to content

Commit

Permalink
EXPERIMENT: try arm64 image with buildx + registry
Browse files Browse the repository at this point in the history
  • Loading branch information
afbjorklund committed Sep 12, 2020
1 parent 6ab74c2 commit 41fb020
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ RAW_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_BUILD)
VERSION ?= v$(RAW_VERSION)

KUBERNETES_VERSION ?= $(shell egrep "DefaultKubernetesVersion =" pkg/minikube/constants/constants.go | cut -d \" -f2)
KIND_VERSION ?= focal
KIC_VERSION ?= $(shell egrep "Version =" pkg/drivers/kic/types.go | cut -d \" -f2)
KIND_VERSION ?= focal-arm64
KIC_VERSION ?= $(shell egrep "Version =" pkg/drivers/kic/types.go | cut -d \" -f2)-arm64

# Default to .0 for higher cache hit rates, as build increments typically don't require new ISO versions
ISO_VERSION ?= v$(VERSION_MAJOR).$(VERSION_MINOR).0
Expand Down Expand Up @@ -581,14 +581,19 @@ storage-provisioner-image: out/storage-provisioner-$(GOARCH) ## Build storage-pr
.PHONY: kind-base-image
kind-base-image: ## builds the base image used for kind.
docker rmi -f $(KIND_BASE_IMAGE_GCR)-snapshot || true
docker build -f ./deploy/kindbase/Dockerfile -t local/kindbase:$(KIND_VERSION)-snapshot ./deploy/kindbase
docker buildx build --platform=linux/arm64 --load -f ./deploy/kindbase/Dockerfile -t local/kindbase:$(KIND_VERSION)-snapshot ./deploy/kindbase
docker tag local/kindbase:$(KIND_VERSION)-snapshot $(KIND_BASE_IMAGE_GCR)-snapshot
docker tag local/kindbase:$(KIND_VERSION)-snapshot $(KIND_BASE_IMAGE_GCR)
docker container inspect --format '{{.Id}}' registry || docker run -d -p 5000:5000 --restart=always --name registry registry:2
docker tag local/kindbase:$(KIND_VERSION)-snapshot localhost:5000/kindbase:$(KIND_VERSION)
docker push localhost:5000/kindbase:$(KIND_VERSION)

.PHONY: kic-base-image
kic-base-image: kind-base-image ## builds the base image used for kic.
docker rmi -f $(KIC_BASE_IMAGE_GCR)-snapshot || true
docker build -f ./deploy/kicbase/Dockerfile -t local/kicbase:$(KIC_VERSION)-snapshot --build-arg COMMIT_SHA=${VERSION}-$(COMMIT) --cache-from $(KIC_BASE_IMAGE_GCR) --target base ./deploy/kicbase
docker pull localhost:5000/kindbase:$(KIND_VERSION)
docker buildx create --driver-opt network=host --use
docker buildx build --platform=linux/arm64 --load -f ./deploy/kicbase/Dockerfile -t local/kicbase:$(KIC_VERSION)-snapshot --build-arg COMMIT_SHA=${VERSION}-$(COMMIT) --cache-from $(KIC_BASE_IMAGE_GCR) --target base ./deploy/kicbase
docker tag local/kicbase:$(KIC_VERSION)-snapshot $(KIC_BASE_IMAGE_GCR)-snapshot
docker tag local/kicbase:$(KIC_VERSION)-snapshot $(KIC_BASE_IMAGE_GCR)
docker tag local/kicbase:$(KIC_VERSION)-snapshot $(KIC_BASE_IMAGE_HUB)
Expand Down
2 changes: 1 addition & 1 deletion deploy/kicbase/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG COMMIT_SHA
# using base image created by kind https://github.com/kubernetes-sigs/kind/blob/v0.8.1/images/base/Dockerfile
# which is an ubuntu 20.04 with an entry-point that helps running systemd
# could be changed to any debian that can run systemd
FROM gcr.io/k8s-minikube/kindbase:focal as base
FROM localhost:5000/kindbase:focal-arm64 as base
USER root

# install system requirements from the regular distro repositories
Expand Down
2 changes: 1 addition & 1 deletion deploy/kindbase/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# start from ubuntu 20.04, this image is reasonably small as a starting point
# for a kubernetes node image, it doesn't contain much we don't need
FROM ubuntu:focal
FROM arm64v8/ubuntu:focal

# copy in static files (configs, scripts)
COPY files/ /
Expand Down

0 comments on commit 41fb020

Please sign in to comment.