Simplify local Docker image build

This commit is contained in:
Frédéric Guillot
2019-02-27 15:13:49 -08:00
parent 4a40095122
commit 6d2b2f4a79
9 changed files with 50 additions and 52 deletions

View File

@@ -1,35 +1,46 @@
DOCKER_IMAGE := kanboard/kanboard
DOCKER_TAG := master
VERSION := $(shell git rev-parse --short HEAD)
.PHONY: all
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}, destination=${dst}"
@ git archive --format=zip --prefix=kanboard/ ${version} -o ${dst}/kanboard-${version}.zip
test-sqlite-coverage:
@ ./vendor/bin/phpunit --coverage-html /tmp/coverage --whitelist app/ -c tests/units.sqlite.xml
@ 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
@@ -37,6 +48,7 @@ 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
@@ -44,6 +56,7 @@ 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
@@ -51,6 +64,7 @@ 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 -x -O --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
@@ -71,7 +85,14 @@ 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:
@ IMAGE_NAME=kanboard/kanboard:latest ./hooks/build
@ docker build --build-arg VERSION=$(VERSION) -t $(DOCKER_IMAGE):$(DOCKER_TAG) .
.PHONY: all
.PHONY: docker-run
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