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>
This commit is contained in:
Yong Tang
2017-11-03 13:29:50 -07:00
committed by Miek Gieben
parent 64c3eb1518
commit 37e1acf9be

View File

@@ -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