Simplify local Docker image build
This commit is contained in:
parent
4a40095122
commit
6d2b2f4a79
|
|
@ -3,18 +3,24 @@
|
|||
.dockerignore
|
||||
.vagrant
|
||||
.idea
|
||||
data/*
|
||||
Makefile
|
||||
.DS_Store
|
||||
.htaccess
|
||||
*.lock
|
||||
*.md
|
||||
*.js
|
||||
*.sh
|
||||
.*.yml
|
||||
*.yml
|
||||
*.js
|
||||
*.md
|
||||
*.sh
|
||||
app.json
|
||||
data/*
|
||||
plugins/*
|
||||
tests
|
||||
ChangeLog
|
||||
composer.json
|
||||
Dockerfile
|
||||
Makefile
|
||||
package.json
|
||||
Vagrantfile
|
||||
web.config
|
||||
node_modules
|
||||
hooks
|
||||
assets/sass
|
||||
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 -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 []
|
||||
|
|
|
|||
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
|
||||
|
||||
.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
|
||||
|
|
|
|||
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)
|
||||
{
|
||||
$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';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
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