diff --git a/.circleci/config.yml b/.circleci/config.yml index e1e0c0a4e..132f788df 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,7 +36,7 @@ buildCoreDNSImage: &buildCoreDNSImage command: | cd ~/go/src/${CIRCLE_PROJECT_USERNAME}/coredns make coredns SYSTEM="GOOS=linux" && \ - docker build -t coredns . && \ + DOCKER_BUILDKIT=1 docker build -t coredns . && \ kind load docker-image coredns jobs: diff --git a/Dockerfile b/Dockerfile index 0eace2550..b840a5777 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:stable-slim +FROM --platform=$BUILDPLATFORM debian:stable-slim SHELL [ "/bin/sh", "-ec" ] RUN export DEBCONF_NONINTERACTIVE_SEEN=true \ @@ -10,7 +10,7 @@ RUN export DEBCONF_NONINTERACTIVE_SEEN=true \ apt-get -yyqq install ca-certificates ; \ apt-get clean -FROM scratch +FROM --platform=$TARGETPLATFORM scratch COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ ADD coredns /coredns diff --git a/Makefile.docker b/Makefile.docker index 65f5fe488..4610b1c10 100644 --- a/Makefile.docker +++ b/Makefile.docker @@ -83,7 +83,7 @@ ifeq ($(DOCKER),) else docker version for arch in $(LINUX_ARCH); do \ - docker build -t $(DOCKER_IMAGE_NAME):$${arch}-$(VERSION) build/docker/$${arch} ;\ + DOCKER_BUILDKIT=1 docker build --platform=$${arch} -t $(DOCKER_IMAGE_NAME):$${arch}-$(VERSION) build/docker/$${arch} ;\ done endif @@ -102,10 +102,6 @@ else done docker manifest create --amend $(DOCKER_IMAGE_NAME):$(VERSION) $(DOCKER_IMAGE_LIST_VERSIONED) docker manifest create --amend $(DOCKER_IMAGE_NAME):latest $(DOCKER_IMAGE_LIST_VERSIONED) - for arch in $(LINUX_ARCH); do \ - docker manifest annotate --arch $${arch} $(DOCKER_IMAGE_NAME):$(VERSION) $(DOCKER_IMAGE_NAME):$${arch}-$(VERSION) ;\ - docker manifest annotate --arch $${arch} $(DOCKER_IMAGE_NAME):latest $(DOCKER_IMAGE_NAME):$${arch}-$(VERSION) ;\ - done docker manifest push --purge $(DOCKER_IMAGE_NAME):$(VERSION) docker manifest push --purge $(DOCKER_IMAGE_NAME):latest TOKEN=$$(curl -s -H "Content-Type: application/json" -X POST -d "{\"username\":\"$(DOCKER_LOGIN)\",\"password\":\"$(DOCKER_PASSWORD)\"}" "https://hub.docker.com/v2/users/login/" | jq -r .token) ; \