summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2019-02-27 15:13:49 -0800
committerFrédéric Guillot <fred@kanboard.net>2019-02-27 17:50:18 -0800
commit6d2b2f4a793fe6f9321fa5ed164af1fd3520e01b (patch)
treee3eef95cd2979946e0f27ca9cbcc8ab57b061c3c
parent4a400951226da20f05472504a5e992981298734e (diff)
Simplify local Docker image build
-rw-r--r--.dockerignore20
-rw-r--r--CONTRIBUTING1
-rw-r--r--Dockerfile11
-rw-r--r--Makefile35
-rw-r--r--app.json8
-rw-r--r--app/functions.php8
-rw-r--r--docker/etc/nginx/nginx.conf2
-rwxr-xr-xdocker/usr/local/bin/entrypoint.sh2
-rwxr-xr-xhooks/build15
9 files changed, 50 insertions, 52 deletions
diff --git a/.dockerignore b/.dockerignore
index ca51d8c4..e17c9e33 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -3,18 +3,24 @@
.dockerignore
.vagrant
.idea
-data/*
-Makefile
-.*.yml
-*.yml
-*.js
+.DS_Store
+.htaccess
+*.lock
*.md
+*.js
*.sh
-app.json
+.*.yml
+*.yml
+data/*
+plugins/*
+tests
+ChangeLog
+composer.json
+Dockerfile
+Makefile
package.json
Vagrantfile
web.config
node_modules
-hooks
assets/sass
assets/vendor \ No newline at end of file
diff --git a/CONTRIBUTING b/CONTRIBUTING
deleted file mode 100644
index a374f1b4..00000000
--- a/CONTRIBUTING
+++ /dev/null
@@ -1 +0,0 @@
-See https://docs.kanboard.org/en/latest/developer_guide/index.html
diff --git a/Dockerfile b/Dockerfile
index 1da18a71..061dc4e7 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -17,15 +17,10 @@ RUN apk update && \
rm -rf /var/www/localhost && \
rm -f /etc/php7/php-fpm.d/www.conf
-RUN cd /tmp \
- && curl -sL -o kb.zip https://github.com/kanboard/kanboard/archive/$VERSION.zip \
- && unzip -qq kb.zip \
- && cd kanboard-* \
- && cp -R . /var/www/app \
- && cd /tmp \
- && rm -rf /tmp/kanboard-* /tmp/*.zip
-
+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 79f2cf61..e38273e1 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/app.json b/app.json
deleted file mode 100644
index fc12f7c5..00000000
--- a/app.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "name": "Kanboard",
- "description": "Kanboard is a simple visual task board",
- "repository": "https://github.com/kanboard/kanboard",
- "logo": "https://kanboard.org/assets/img/icon.svg",
- "keywords": ["kanboard", "kanban", "php", "agile"],
- "addons": ["heroku-postgresql:hobby-dev"]
-}
diff --git a/app/functions.php b/app/functions.php
index bb739d0f..fc278029 100644
--- a/app/functions.php
+++ b/app/functions.php
@@ -166,8 +166,6 @@ function array_column_sum(array &$input, $column)
*/
function build_app_version($ref, $commit_hash)
{
- $version = 'master';
-
if ($ref !== '$Format:%d$') {
$tag = preg_replace('/\s*\(.*tag:\sv([^,]+).*\)/i', '\1', $ref);
@@ -177,10 +175,12 @@ function build_app_version($ref, $commit_hash)
}
if ($commit_hash !== '$Format:%H$') {
- $version .= '.'.$commit_hash;
+ return 'master.'.$commit_hash;
+ } else if (file_exists('/version.txt')) {
+ return file_get_contents('/version.txt');
}
- return $version;
+ return 'master.unknown_revision';
}
/**
diff --git a/docker/etc/nginx/nginx.conf b/docker/etc/nginx/nginx.conf
index fcc9a9aa..df26ad46 100644
--- a/docker/etc/nginx/nginx.conf
+++ b/docker/etc/nginx/nginx.conf
@@ -23,7 +23,7 @@ http {
server {
listen 80;
- listen 443 ssl;
+ listen 443 ssl http2;
ssl_certificate /etc/nginx/ssl/kanboard.crt;
ssl_certificate_key /etc/nginx/ssl/kanboard.key;
server_name localhost;
diff --git a/docker/usr/local/bin/entrypoint.sh b/docker/usr/local/bin/entrypoint.sh
index 61ce9207..5618b4bc 100755
--- a/docker/usr/local/bin/entrypoint.sh
+++ b/docker/usr/local/bin/entrypoint.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-#generate a new self signed SSL certificate when none is provided in the volume
+# Generate a new self signed SSL certificate when none is provided in the volume
if [ ! -f /etc/nginx/ssl/kanboard.key ] || [ ! -f /etc/nginx/ssl/kanboard.crt ]
then
openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/kanboard.key -out /etc/nginx/ssl/kanboard.crt -subj "/C=GB/ST=London/L=London/O=Self Signed/OU=IT Department/CN=kanboard.org"
diff --git a/hooks/build b/hooks/build
deleted file mode 100755
index 043be1f7..00000000
--- a/hooks/build
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-
-VERSION=master
-
-if [ "$SOURCE_BRANCH" != "" ]; then
- VERSION=$SOURCE_BRANCH
-
- if [ "$SOURCE_BRANCH" == "latest" ]; then
- VERSION=master
- fi
-fi
-
-echo "Building $VERSION"
-
-docker build --build-arg VERSION=$VERSION -t $IMAGE_NAME .