Add Docker manifest with multiple architectures

This commit is contained in:
Frédéric Guillot 2019-05-13 23:12:19 -07:00 committed by fguillot
parent 6957edc8b0
commit 96dd20c0cd
5 changed files with 83 additions and 19 deletions

View File

@ -1,4 +1,4 @@
FROM alpine:3.9
FROM alpine:3.9.4
VOLUME /var/www/app/data
VOLUME /var/www/app/plugins

26
Dockerfile.arm32v6 Normal file
View File

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

View File

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

26
Dockerfile.arm64v8 Normal file
View File

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

View File

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