Simplify local Docker image build
This commit is contained in:
parent
4a40095122
commit
6d2b2f4a79
|
|
@ -3,18 +3,24 @@
|
||||||
.dockerignore
|
.dockerignore
|
||||||
.vagrant
|
.vagrant
|
||||||
.idea
|
.idea
|
||||||
data/*
|
.DS_Store
|
||||||
Makefile
|
.htaccess
|
||||||
|
*.lock
|
||||||
|
*.md
|
||||||
|
*.js
|
||||||
|
*.sh
|
||||||
.*.yml
|
.*.yml
|
||||||
*.yml
|
*.yml
|
||||||
*.js
|
data/*
|
||||||
*.md
|
plugins/*
|
||||||
*.sh
|
tests
|
||||||
app.json
|
ChangeLog
|
||||||
|
composer.json
|
||||||
|
Dockerfile
|
||||||
|
Makefile
|
||||||
package.json
|
package.json
|
||||||
Vagrantfile
|
Vagrantfile
|
||||||
web.config
|
web.config
|
||||||
node_modules
|
node_modules
|
||||||
hooks
|
|
||||||
assets/sass
|
assets/sass
|
||||||
assets/vendor
|
assets/vendor
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
See https://docs.kanboard.org/en/latest/developer_guide/index.html
|
|
||||||
11
Dockerfile
11
Dockerfile
|
|
@ -17,15 +17,10 @@ RUN apk update && \
|
||||||
rm -rf /var/www/localhost && \
|
rm -rf /var/www/localhost && \
|
||||||
rm -f /etc/php7/php-fpm.d/www.conf
|
rm -f /etc/php7/php-fpm.d/www.conf
|
||||||
|
|
||||||
RUN cd /tmp \
|
ADD . /var/www/app
|
||||||
&& 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 docker/ /
|
ADD docker/ /
|
||||||
|
|
||||||
|
RUN rm -rf /var/www/app/docker && echo $VERSION > /version.txt
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||||
CMD []
|
CMD []
|
||||||
|
|
|
||||||
35
Makefile
35
Makefile
|
|
@ -1,35 +1,46 @@
|
||||||
|
DOCKER_IMAGE := kanboard/kanboard
|
||||||
|
DOCKER_TAG := master
|
||||||
|
VERSION := $(shell git rev-parse --short HEAD)
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
all: static
|
all: static
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
@ rm -rf ./node_modules
|
@ rm -rf ./node_modules
|
||||||
|
|
||||||
|
.PHONY: static
|
||||||
static: clean
|
static: clean
|
||||||
@ npm install
|
@ npm install
|
||||||
@ ./node_modules/.bin/gulp vendor js css
|
@ ./node_modules/.bin/gulp vendor js css
|
||||||
@ ./node_modules/.bin/jshint assets/js/{core,components,polyfills}
|
@ ./node_modules/.bin/jshint assets/js/{core,components,polyfills}
|
||||||
|
|
||||||
|
.PHONY: jshint
|
||||||
jshint:
|
jshint:
|
||||||
@ ./node_modules/.bin/jshint assets/js/{core,components,polyfills}
|
@ ./node_modules/.bin/jshint assets/js/{core,components,polyfills}
|
||||||
|
|
||||||
|
.PHONY: archive
|
||||||
archive:
|
archive:
|
||||||
@ echo "Build archive: version=${version}, destination=${dst}"
|
@ echo "Build archive: version=$(VERSION)"
|
||||||
@ git archive --format=zip --prefix=kanboard/ ${version} -o ${dst}/kanboard-${version}.zip
|
@ git archive --format=zip --prefix=kanboard/ $(VERSION) -o kanboard-$(VERSION).zip
|
||||||
|
|
||||||
test-sqlite-coverage:
|
|
||||||
@ ./vendor/bin/phpunit --coverage-html /tmp/coverage --whitelist app/ -c tests/units.sqlite.xml
|
|
||||||
|
|
||||||
|
.PHONY: test-sqlite
|
||||||
test-sqlite:
|
test-sqlite:
|
||||||
@ ./vendor/bin/phpunit -c tests/units.sqlite.xml
|
@ ./vendor/bin/phpunit -c tests/units.sqlite.xml
|
||||||
|
|
||||||
|
.PHONY: test-mysql
|
||||||
test-mysql:
|
test-mysql:
|
||||||
@ ./vendor/bin/phpunit -c tests/units.mysql.xml
|
@ ./vendor/bin/phpunit -c tests/units.mysql.xml
|
||||||
|
|
||||||
|
.PHONY: test-postgres
|
||||||
test-postgres:
|
test-postgres:
|
||||||
@ ./vendor/bin/phpunit -c tests/units.postgres.xml
|
@ ./vendor/bin/phpunit -c tests/units.postgres.xml
|
||||||
|
|
||||||
|
.PHONY: test-browser
|
||||||
test-browser:
|
test-browser:
|
||||||
@ ./vendor/bin/phpunit -c tests/acceptance.xml
|
@ ./vendor/bin/phpunit -c tests/acceptance.xml
|
||||||
|
|
||||||
|
.PHONY: integration-test-mysql
|
||||||
integration-test-mysql:
|
integration-test-mysql:
|
||||||
@ composer install --dev
|
@ composer install --dev
|
||||||
@ docker-compose -f tests/docker/compose.integration.mysql.yaml build
|
@ 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 up tests
|
||||||
@ docker-compose -f tests/docker/compose.integration.mysql.yaml down
|
@ docker-compose -f tests/docker/compose.integration.mysql.yaml down
|
||||||
|
|
||||||
|
.PHONY: integration-test-postgres
|
||||||
integration-test-postgres:
|
integration-test-postgres:
|
||||||
@ composer install --dev
|
@ composer install --dev
|
||||||
@ docker-compose -f tests/docker/compose.integration.postgres.yaml build
|
@ 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 up tests
|
||||||
@ docker-compose -f tests/docker/compose.integration.postgres.yaml down
|
@ docker-compose -f tests/docker/compose.integration.postgres.yaml down
|
||||||
|
|
||||||
|
.PHONY: integration-test-sqlite
|
||||||
integration-test-sqlite:
|
integration-test-sqlite:
|
||||||
@ composer install --dev
|
@ composer install --dev
|
||||||
@ docker-compose -f tests/docker/compose.integration.sqlite.yaml build
|
@ 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 up tests
|
||||||
@ docker-compose -f tests/docker/compose.integration.sqlite.yaml down
|
@ docker-compose -f tests/docker/compose.integration.sqlite.yaml down
|
||||||
|
|
||||||
|
.PHONY: sql
|
||||||
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 -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
|
@ 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
|
@ 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-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
|
||||||
|
|
|
||||||
8
app.json
8
app.json
|
|
@ -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"]
|
|
||||||
}
|
|
||||||
|
|
@ -166,8 +166,6 @@ function array_column_sum(array &$input, $column)
|
||||||
*/
|
*/
|
||||||
function build_app_version($ref, $commit_hash)
|
function build_app_version($ref, $commit_hash)
|
||||||
{
|
{
|
||||||
$version = 'master';
|
|
||||||
|
|
||||||
if ($ref !== '$Format:%d$') {
|
if ($ref !== '$Format:%d$') {
|
||||||
$tag = preg_replace('/\s*\(.*tag:\sv([^,]+).*\)/i', '\1', $ref);
|
$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$') {
|
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';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ http {
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
listen 443 ssl;
|
listen 443 ssl http2;
|
||||||
ssl_certificate /etc/nginx/ssl/kanboard.crt;
|
ssl_certificate /etc/nginx/ssl/kanboard.crt;
|
||||||
ssl_certificate_key /etc/nginx/ssl/kanboard.key;
|
ssl_certificate_key /etc/nginx/ssl/kanboard.key;
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/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 ]
|
if [ ! -f /etc/nginx/ssl/kanboard.key ] || [ ! -f /etc/nginx/ssl/kanboard.crt ]
|
||||||
then
|
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"
|
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"
|
||||||
|
|
|
||||||
15
hooks/build
15
hooks/build
|
|
@ -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 .
|
|
||||||
Loading…
Reference in New Issue