From 96dd20c0cd0b3d30da7240444be734d92e3c0536 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Mon, 13 May 2019 23:12:19 -0700 Subject: Add Docker manifest with multiple architectures --- Dockerfile | 2 +- Dockerfile.arm32v6 | 26 ++++++++++++++++++++++++++ Dockerfile.arm32v7 | 2 +- Dockerfile.arm64v8 | 26 ++++++++++++++++++++++++++ Makefile | 46 +++++++++++++++++++++++++++++----------------- 5 files changed, 83 insertions(+), 19 deletions(-) create mode 100644 Dockerfile.arm32v6 create mode 100644 Dockerfile.arm64v8 diff --git a/Dockerfile b/Dockerfile index 061dc4e7..b3a83012 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.9 +FROM alpine:3.9.4 VOLUME /var/www/app/data VOLUME /var/www/app/plugins diff --git a/Dockerfile.arm32v6 b/Dockerfile.arm32v6 new file mode 100644 index 00000000..1092360f --- /dev/null +++ b/Dockerfile.arm32v6 @@ -0,0 +1,26 @@ +FROM arm32v6/alpine:3.9.4 + +VOLUME /var/www/app/data +VOLUME /var/www/app/plugins +VOLUME /etc/nginx/ssl + +EXPOSE 80 443 + +ARG VERSION + +RUN apk update && \ + apk add openssl unzip nginx bash ca-certificates s6 curl ssmtp mailx php7 php7-phar php7-curl \ + php7-fpm php7-json php7-zlib php7-xml php7-dom php7-ctype php7-opcache php7-zip php7-iconv \ + php7-pdo php7-pdo_mysql php7-pdo_sqlite php7-pdo_pgsql php7-mbstring php7-session php7-bcmath \ + php7-gd php7-mcrypt php7-openssl php7-sockets php7-posix php7-ldap php7-simplexml && \ + rm -rf /var/cache/apk/* && \ + rm -rf /var/www/localhost && \ + rm -f /etc/php7/php-fpm.d/www.conf + +ADD . /var/www/app +ADD docker/ / + +RUN rm -rf /var/www/app/docker && echo $VERSION > /version.txt + +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] +CMD [] diff --git a/Dockerfile.arm32v7 b/Dockerfile.arm32v7 index a25b37a1..2f0daa69 100644 --- a/Dockerfile.arm32v7 +++ b/Dockerfile.arm32v7 @@ -1,4 +1,4 @@ -FROM arm32v7/alpine:3.9 +FROM arm32v7/alpine:3.9.4 VOLUME /var/www/app/data VOLUME /var/www/app/plugins diff --git a/Dockerfile.arm64v8 b/Dockerfile.arm64v8 new file mode 100644 index 00000000..4fc5f9ee --- /dev/null +++ b/Dockerfile.arm64v8 @@ -0,0 +1,26 @@ +FROM arm64v8/alpine:3.9.4 + +VOLUME /var/www/app/data +VOLUME /var/www/app/plugins +VOLUME /etc/nginx/ssl + +EXPOSE 80 443 + +ARG VERSION + +RUN apk update && \ + apk add openssl unzip nginx bash ca-certificates s6 curl ssmtp mailx php7 php7-phar php7-curl \ + php7-fpm php7-json php7-zlib php7-xml php7-dom php7-ctype php7-opcache php7-zip php7-iconv \ + php7-pdo php7-pdo_mysql php7-pdo_sqlite php7-pdo_pgsql php7-mbstring php7-session php7-bcmath \ + php7-gd php7-mcrypt php7-openssl php7-sockets php7-posix php7-ldap php7-simplexml && \ + rm -rf /var/cache/apk/* && \ + rm -rf /var/www/localhost && \ + rm -f /etc/php7/php-fpm.d/www.conf + +ADD . /var/www/app +ADD docker/ / + +RUN rm -rf /var/www/app/docker && echo $VERSION > /version.txt + +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] +CMD [] diff --git a/Makefile b/Makefile index 4bdbd23a..92e1224d 100644 --- a/Makefile +++ b/Makefile @@ -1,46 +1,40 @@ -DOCKER_IMAGE := kanboard/kanboard +DOCKER_IMAGE := docker.io/kanboard/kanboard DOCKER_TAG := master VERSION := $(shell git rev-parse --short HEAD) -.PHONY: all +.PHONY: all clean static jshint archive test-sqlite test-mysql test-postgres test-browser \ + integration-test-mysql integration-test-postgres integration-test-sqlite sql \ + docker-image docker-manifest docker-run docker-sh + all: static -.PHONY: clean clean: @ rm -rf ./node_modules -.PHONY: static static: clean @ npm install @ ./node_modules/.bin/gulp vendor js css @ ./node_modules/.bin/jshint assets/js/{core,components,polyfills} -.PHONY: jshint jshint: @ ./node_modules/.bin/jshint assets/js/{core,components,polyfills} -.PHONY: archive archive: @ echo "Build archive: version=$(VERSION)" @ git archive --format=zip --prefix=kanboard/ $(VERSION) -o kanboard-$(VERSION).zip -.PHONY: test-sqlite test-sqlite: @ ./vendor/bin/phpunit -c tests/units.sqlite.xml -.PHONY: test-mysql test-mysql: @ ./vendor/bin/phpunit -c tests/units.mysql.xml -.PHONY: test-postgres test-postgres: @ ./vendor/bin/phpunit -c tests/units.postgres.xml -.PHONY: test-browser test-browser: @ ./vendor/bin/phpunit -c tests/acceptance.xml -.PHONY: integration-test-mysql integration-test-mysql: @ composer install --dev @ docker-compose -f tests/docker/compose.integration.mysql.yaml build @@ -48,7 +42,6 @@ integration-test-mysql: @ docker-compose -f tests/docker/compose.integration.mysql.yaml up tests @ docker-compose -f tests/docker/compose.integration.mysql.yaml down -.PHONY: integration-test-postgres integration-test-postgres: @ composer install --dev @ docker-compose -f tests/docker/compose.integration.postgres.yaml build @@ -56,7 +49,6 @@ integration-test-postgres: @ docker-compose -f tests/docker/compose.integration.postgres.yaml up tests @ docker-compose -f tests/docker/compose.integration.postgres.yaml down -.PHONY: integration-test-sqlite integration-test-sqlite: @ composer install --dev @ docker-compose -f tests/docker/compose.integration.sqlite.yaml build @@ -64,7 +56,6 @@ integration-test-sqlite: @ docker-compose -f tests/docker/compose.integration.sqlite.yaml up tests @ docker-compose -f tests/docker/compose.integration.sqlite.yaml down -.PHONY: sql sql: @ pg_dump --schema-only --no-owner --no-privileges --quote-all-identifiers -n public --file app/Schema/Sql/postgres.sql kanboard @ pg_dump -d kanboard --column-inserts --data-only --table settings >> app/Schema/Sql/postgres.sql @@ -86,14 +77,35 @@ sql: @ grep -v "SET idle_in_transaction_session_timeout = 0;" app/Schema/Sql/postgres.sql > temp && mv temp app/Schema/Sql/postgres.sql -.PHONY: docker-image docker-image: @ docker build --build-arg VERSION=$(VERSION) -t $(DOCKER_IMAGE):$(DOCKER_TAG) . -.PHONY: docker-run +docker-manifest: + for version in $(VERSION) latest; do \ + docker build --build-arg VERSION=$${version} -t $(DOCKER_IMAGE):amd64-$${version} -f Dockerfile . && \ + docker build --build-arg VERSION=$${version} -t $(DOCKER_IMAGE):arm32v6-$${version} -f Dockerfile.arm32v6 . && \ + docker build --build-arg VERSION=$${version} -t $(DOCKER_IMAGE):arm32v7-$${version} -f Dockerfile.arm32v7 . && \ + docker build --build-arg VERSION=$${version} -t $(DOCKER_IMAGE):arm64v8-$${version} -f Dockerfile.arm64v8 . && \ + docker push $(DOCKER_IMAGE):amd64-$${version} && \ + docker push $(DOCKER_IMAGE):arm32v6-$${version} && \ + docker push $(DOCKER_IMAGE):arm32v7-$${version} && \ + docker push $(DOCKER_IMAGE):arm64v8-$${version} && \ + docker manifest create --amend $(DOCKER_IMAGE):$${version} \ + $(DOCKER_IMAGE):amd64-$${version} \ + $(DOCKER_IMAGE):arm32v6-$${version} \ + $(DOCKER_IMAGE):arm32v7-$${version} \ + $(DOCKER_IMAGE):arm64v8-$${version} && \ + docker manifest annotate $(DOCKER_IMAGE):$${version} \ + $(DOCKER_IMAGE):arm32v6-$${version} --os linux --arch arm --variant v6 && \ + docker manifest annotate $(DOCKER_IMAGE):$${version} \ + $(DOCKER_IMAGE):arm32v7-$${version} --os linux --arch arm --variant v7 && \ + docker manifest annotate $(DOCKER_IMAGE):$${version} \ + $(DOCKER_IMAGE):arm64v8-$${version} --os linux --arch arm64 --variant v8 && \ + docker manifest push --purge $(DOCKER_IMAGE):$${version} ;\ + done + docker-run: @ docker run --rm --name=kanboard -p 80:80 -p 443:443 $(DOCKER_IMAGE):$(DOCKER_TAG) -.PHONY: docker-sh docker-sh: @ docker exec -ti kanboard bash -- cgit v1.2.3