summaryrefslogtreecommitdiff
path: root/tests/docker
diff options
context:
space:
mode:
authori00171 <anton.delitsch@implema.se>2016-06-26 18:35:25 +0200
committeri00171 <anton.delitsch@implema.se>2016-06-26 18:35:25 +0200
commit47039d32c84ba699867920d2c3cb47a34b199b9d (patch)
tree4fbc2ec34889baeab00085e0509055dca7daee6a /tests/docker
parent911be6ed00c1ece5d9ef2c16e80899bb7bffad67 (diff)
parentc110dffefe259c13e60193fb81ebb9d4b79504de (diff)
Merge branch 'master' of https://github.com/fguillot/kanboard
Diffstat (limited to 'tests/docker')
-rw-r--r--tests/docker/Dockerfile.xenial24
-rw-r--r--tests/docker/compose.integration.mysql.yaml27
-rw-r--r--tests/docker/compose.integration.postgres.yaml26
-rw-r--r--tests/docker/compose.integration.sqlite.yaml16
-rwxr-xr-xtests/docker/entrypoint.sh33
-rw-r--r--tests/docker/supervisord.conf6
6 files changed, 132 insertions, 0 deletions
diff --git a/tests/docker/Dockerfile.xenial b/tests/docker/Dockerfile.xenial
new file mode 100644
index 00000000..a48d0525
--- /dev/null
+++ b/tests/docker/Dockerfile.xenial
@@ -0,0 +1,24 @@
+FROM ubuntu:16.04
+
+RUN mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/supervisor
+
+RUN apt-get update -qq && \
+ apt-get install -y apache2 supervisor cron curl unzip \
+ libapache2-mod-php7.0 php7.0-cli php7.0-mbstring php7.0-xml php7.0-mysql php7.0-sqlite3 \
+ php7.0-opcache php7.0-json php7.0-pgsql php7.0-ldap php7.0-gd php7.0-zip && \
+ apt clean && \
+ echo "ServerName localhost" >> /etc/apache2/apache2.conf && \
+ sed -ri 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf && \
+ a2enmod rewrite && \
+ curl -sS https://getcomposer.org/installer | php -- --filename=/usr/local/bin/composer
+
+COPY . /var/www/html
+
+RUN chown -R www-data:www-data /var/www/html/data /var/www/html/plugins
+
+COPY tests/docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
+COPY tests/configs /configs/
+
+EXPOSE 80
+
+ENTRYPOINT ["/var/www/html/tests/docker/entrypoint.sh"]
diff --git a/tests/docker/compose.integration.mysql.yaml b/tests/docker/compose.integration.mysql.yaml
new file mode 100644
index 00000000..6eda5eec
--- /dev/null
+++ b/tests/docker/compose.integration.mysql.yaml
@@ -0,0 +1,27 @@
+version: '2'
+services:
+ mysql:
+ image: mysql:5.7
+ environment:
+ MYSQL_ROOT_PASSWORD: "kanboard"
+ MYSQL_DATABASE: "kanboard"
+ MYSQL_USER: "kanboard"
+ MYSQL_PASSWORD: "kanboard"
+ ports:
+ - "3306:3306"
+ app:
+ build:
+ context: ../..
+ dockerfile: tests/docker/Dockerfile.xenial
+ ports:
+ - "8000:80"
+ depends_on:
+ - mysql
+ command: config-mysql
+ tests:
+ build:
+ context: ../..
+ dockerfile: tests/docker/Dockerfile.xenial
+ depends_on:
+ - app
+ command: integration-test-mysql
diff --git a/tests/docker/compose.integration.postgres.yaml b/tests/docker/compose.integration.postgres.yaml
new file mode 100644
index 00000000..ed095248
--- /dev/null
+++ b/tests/docker/compose.integration.postgres.yaml
@@ -0,0 +1,26 @@
+version: '2'
+services:
+ postgres:
+ image: postgres:9.5
+ environment:
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: postgres
+ POSTGRES_DB: kanboard
+ ports:
+ - "5432:5432"
+ app:
+ build:
+ context: ../..
+ dockerfile: tests/docker/Dockerfile.xenial
+ ports:
+ - "8000:80"
+ depends_on:
+ - postgres
+ command: config-postgres
+ tests:
+ build:
+ context: ../..
+ dockerfile: tests/docker/Dockerfile.xenial
+ depends_on:
+ - app
+ command: integration-test-postgres
diff --git a/tests/docker/compose.integration.sqlite.yaml b/tests/docker/compose.integration.sqlite.yaml
new file mode 100644
index 00000000..6431484e
--- /dev/null
+++ b/tests/docker/compose.integration.sqlite.yaml
@@ -0,0 +1,16 @@
+version: '2'
+services:
+ app:
+ build:
+ context: ../..
+ dockerfile: tests/docker/Dockerfile.xenial
+ ports:
+ - "8000:80"
+ command: config-sqlite
+ tests:
+ build:
+ context: ../..
+ dockerfile: tests/docker/Dockerfile.xenial
+ depends_on:
+ - app
+ command: integration-test-sqlite
diff --git a/tests/docker/entrypoint.sh b/tests/docker/entrypoint.sh
new file mode 100755
index 00000000..a88c7ed8
--- /dev/null
+++ b/tests/docker/entrypoint.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+
+function wait_schema_creation() {
+ curl -s http://app/login > /dev/null
+ sleep $1
+}
+
+case "$1" in
+"config-sqlite")
+ cp /configs/config.sqlite.php /var/www/html/config.php
+ /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
+ ;;
+"config-postgres")
+ cp /configs/config.postgres.php /var/www/html/config.php
+ /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
+ ;;
+"config-mysql")
+ cp /configs/config.mysql.php /var/www/html/config.php
+ /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
+ ;;
+"integration-test-sqlite")
+ wait_schema_creation 1
+ /var/www/html/vendor/phpunit/phpunit/phpunit -c /var/www/html/tests/integration.sqlite.xml
+ ;;
+"integration-test-postgres")
+ wait_schema_creation 5
+ /var/www/html/vendor/phpunit/phpunit/phpunit -c /var/www/html/tests/integration.postgres.xml
+ ;;
+"integration-test-mysql")
+ wait_schema_creation 15
+ /var/www/html/vendor/phpunit/phpunit/phpunit -c /var/www/html/tests/integration.mysql.xml
+ ;;
+esac
diff --git a/tests/docker/supervisord.conf b/tests/docker/supervisord.conf
new file mode 100644
index 00000000..4d5ee621
--- /dev/null
+++ b/tests/docker/supervisord.conf
@@ -0,0 +1,6 @@
+[supervisord]
+nodaemon=true
+
+[program:apache2]
+command=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND"
+autorestart=true