diff options
author | 2017-11-03 13:29:50 -0700 | |
---|---|---|
committer | 2017-11-03 20:29:50 +0000 | |
commit | 37e1acf9be93507e8eed4b8476d01132416d35fb (patch) | |
tree | 8158611eb1e43058b9eb288a4f313d1c410538ef | |
parent | 64c3eb15184d48590f0ee48bc861268d85e37a1d (diff) | |
download | coredns-37e1acf9be93507e8eed4b8476d01132416d35fb.tar.gz coredns-37e1acf9be93507e8eed4b8476d01132416d35fb.tar.zst coredns-37e1acf9be93507e8eed4b8476d01132416d35fb.zip |
Update docker-build steps in Makefile.release (#1200)
* Update docker-build steps in Makefile.release
for different architectures
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Update to use `case ... esac` in shell script
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Remove `RUN` cmd in Dockerfile in case of non amd64 CPU
ssl will only be supported on amd64 CPUs for now.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
-rw-r--r-- | Makefile.release | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/Makefile.release b/Makefile.release index ab06006dc..6328ad122 100644 --- a/Makefile.release +++ b/Makefile.release @@ -100,9 +100,35 @@ upload: .PHONY: docker-build docker-build: tar + # Steps: + # 1. Copy appropriate coredns binary to build/docker/linux/<arch> + # 2. Copy Dockerfile to build/docker/linux/<arch> + # 3. Replace base image from alpine:latest to <arch>/alpine:latest + # 4. Comment RUN in Dockerfile + # <arch>: + # arm: arm32v6 + # arm64: arm64v8 + rm -rf build/docker for arch in $(LINUX_ARCH); do \ - tar -xzf release/$(NAME)_$(VERSION)_linux_$$arch.tgz ;\ - docker build -t coredns . ;\ + mkdir -p build/docker/linux/$$arch ;\ + tar -xzf release/$(NAME)_$(VERSION)_linux_$$arch.tgz -C build/docker/linux/$$arch ;\ + cp Dockerfile build/docker/linux/$$arch ;\ + if [ $$arch != amd64 ]; then \ + case $$arch in \ + arm) \ + BASEIMAGE=arm32v6 ;\ + ;; \ + arm64) \ + BASEIMAGE=arm64v8 ;\ + ;; \ + *) \ + BASEIMAGE=$$arch ;\ + ;; \ + esac ;\ + sed -e "s/alpine:latest/$$BASEIMAGE\\/alpine:latest/" -i build/docker/linux/$$arch/Dockerfile ;\ + sed -e "s/^\\s*RUN/#RUN/" -i build/docker/linux/$$arch/Dockerfile ;\ + fi ;\ + docker build -t coredns build/docker/linux/$$arch ;\ docker tag coredns $(DOCKER_IMAGE_NAME):coredns-$$arch ;\ done |