aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Siegfried <david.siegfried@uni-vechta.de>2022-06-21 09:04:10 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2022-06-21 09:04:10 +0000
commit8ce1b740c144abf8855b5ea7580d09be6af467fa (patch)
treeee0ec1e1f2a73ce40f3f046b0b8f44e823ad8fb2
parentb333f3fa1ea4d661db10e88325152eb2ef5437f3 (diff)
add gitlab-ci, closes #606
Closes #606 Merge request studip/studip!574
-rw-r--r--.gitlab-ci.yml123
-rw-r--r--.gitlab/scripts/install_db.sh25
-rw-r--r--.phplint.yml8
-rw-r--r--composer.json3
-rw-r--r--composer.lock120
-rw-r--r--docker-compose-dev.yml50
-rw-r--r--docker-compose.yml49
-rw-r--r--docker/Readme.md9
-rw-r--r--docker/build_images.sh17
-rw-r--r--docker/release-cli/Dockerfile6
-rw-r--r--docker/studip/Dockerfile60
-rw-r--r--docker/studip/Dockerfile-Dev38
-rw-r--r--docker/studip/config_local.php46
-rw-r--r--docker/studip/docker-entrypoint.sh44
-rw-r--r--docker/tests/php72/Dockerfile24
-rw-r--r--docker/tests/php74/Dockerfile23
16 files changed, 642 insertions, 3 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..52b65c6
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,123 @@
+variables:
+ MYSQL_RANDOM_ROOT_PASSWORD: 1
+ MYSQL_DATABASE: studip_db
+ MYSQL_USER: studip_user
+ MYSQL_PASSWORD: studip_password
+ MYSQL_HOST: mariadb
+
+stages:
+ - Checks
+ - Packaging
+ - Release
+ - Tests
+ - Build
+
+Linting:
+ stage: Checks
+ image: studip/studip:tests
+ allow_failure: false
+ rules:
+ - if: $CI_COMMIT_BRANCH == 'main'
+ before_script:
+ - make composer-dev
+ script:
+ - php -d memory_limit=-1 composer/bin/phplint
+
+Unit Test:
+ services:
+ - mariadb
+ image: studip/studip:tests
+ stage: Tests
+ allow_failure: false
+ rules:
+ - if: $CI_COMMIT_BRANCH == 'main'
+ before_script:
+ - cp ./docker/studip/config_local.php ./config/config_local.inc.php
+ - cp ./config/config.inc.php.dist ./config/config.inc.php
+ script:
+ - make test
+
+Functional Test:
+ services:
+ - mariadb
+ stage: Tests
+ image: studip/studip:tests
+ allow_failure: false
+ rules:
+ - if: $CI_COMMIT_BRANCH == 'main'
+ before_script:
+ - chmod +x ./.gitlab/scripts/install_db.sh
+ - ./.gitlab/scripts/install_db.sh
+ - cp ./docker/studip/config_local.php ./config/config_local.inc.php
+ - cp ./config/config.inc.php.dist ./config/config.inc.php
+ - make
+ - ./cli/studip migrate
+ script:
+ - make test-functional
+
+JSONAPI Test:
+ services:
+ - mariadb
+ - codeception
+ stage: Tests
+ image: studip/studip:tests
+ allow_failure: false
+ rules:
+ - if: $CI_COMMIT_BRANCH == 'main'
+ before_script:
+ - chmod +x ./.gitlab/scripts/install_db.sh
+ - ./.gitlab/scripts/install_db.sh
+ - cp ./docker/studip/config_local.php ./config/config_local.inc.php
+ - cp ./config/config.inc.php.dist ./config/config.inc.php
+ - make
+ - ./cli/studip migrate
+ script:
+ - make test-jsonapi
+
+Packaging:
+ stage: Packaging
+ image: studip/studip:tests
+ rules:
+ - if: $CI_COMMIT_TAG
+ before_script:
+ - echo $CI_JOB_ID
+ - echo GE_JOB_NAME=$CI_JOB_NAME >> .packaging.env
+ - mkdir .pkg
+ script:
+ - echo 'Running packaging job'
+ - make build clean-npm
+ - zip -r9 .pkg/studip-release-$CI_COMMIT_TAG.zip *
+ - tar -czf .pkg/studip-release-$CI_COMMIT_TAG.tar.gz *
+ artifacts:
+ untracked: true
+ name: 'Stud.IP-Release-$CI_COMMIT_TAG'
+ paths:
+ - ./.pkg/studip-release.zip
+ - ./.pkg/studip-release.tar.gz
+ reports:
+ dotenv: .packaging.env
+
+Release:
+ stage: Release
+ image: studip/release-cli
+ rules:
+ - if: $CI_COMMIT_TAG
+ variables:
+ SETTINGS__GITLAB_ACCESS_TOKEN: $GITLAB_ACCESS_TOKEN
+ script:
+ - echo 'Running release job'
+ needs:
+ - job: Packaging
+ artifacts: true
+ release:
+ name: "Stud.IP-Release-$CI_COMMIT_TAG"
+ description: "Created using the release"
+ tag_name: "$CI_COMMIT_TAG"
+ assets:
+ links:
+ - name: "Stud.IP-Release-$CI_COMMIT_TAG.zip"
+ url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/artifacts/${CI_COMMIT_TAG}/raw/.pkg/studip-release.zip?job=${GE_JOB_NAME}"
+ link_type: package
+ - name: "Stud.IP-Release-$CI_COMMIT_TAG.tar.gz"
+ url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/artifacts/${CI_COMMIT_TAG}/raw/.pkg/studip-release.tar.gz?job=${GE_JOB_NAME}"
+ link_type: package
diff --git a/.gitlab/scripts/install_db.sh b/.gitlab/scripts/install_db.sh
new file mode 100644
index 0000000..e6cce3b
--- /dev/null
+++ b/.gitlab/scripts/install_db.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+set -e
+
+if [ $(mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE -e "show tables;" --batch | wc -l) -eq 0 ]; then
+
+ # Setup mysql database
+ echo "INSTALL DB"
+ mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE < ./db/studip.sql
+ echo "INSTALL DEFAULT DATA"
+ mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE < ./db/studip_default_data.sql
+ mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE < ./db/studip_resources_default_data.sql
+
+ echo "INSTALL ROOTUSER"
+ mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE < ./db/studip_root_user.sql
+
+ # Check if demodata is required
+ if [ ! -z $DEMO_DATA ]; then
+ echo "INSTALL DEMODATA"
+ mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE < ./db/studip_demo_data.sql
+ fi
+
+ echo "INSTALLATION FINISHED"
+else
+ echo "Found some SQL table. Skipping installation"
+fi \ No newline at end of file
diff --git a/.phplint.yml b/.phplint.yml
new file mode 100644
index 0000000..663554c
--- /dev/null
+++ b/.phplint.yml
@@ -0,0 +1,8 @@
+path: ./
+jobs: 10
+cache: .phplint-cache
+extensions:
+ - php
+exclude:
+ - vendor
+ - composer
diff --git a/composer.json b/composer.json
index 569f700..395c367 100644
--- a/composer.json
+++ b/composer.json
@@ -11,7 +11,8 @@
"php-http/curl-client": "~1.7.0",
"woohoolabs/yang": "2.3.2",
"codeception/codeception": "~4.1.21",
- "codeception/module-asserts": "^1.3"
+ "codeception/module-asserts": "^1.3",
+ "overtrue/phplint": "^3.0"
},
"require": {
"php": "^7.2",
diff --git a/composer.lock b/composer.lock
index 3ec6357..34d1a2e 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "2fa6a856bbe442274874aeabe26f054b",
+ "content-hash": "28f7b44e60723efc25ae44ea906ee3a1",
"packages": [
{
"name": "algo26-matthias/idna-convert",
@@ -4367,6 +4367,122 @@
"time": "2020-11-13T09:40:50+00:00"
},
{
+ "name": "n98/junit-xml",
+ "version": "1.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/cmuench/junit-xml.git",
+ "reference": "0017dd92ac8cb619f02e32f4cffd768cfe327c73"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/cmuench/junit-xml/zipball/0017dd92ac8cb619f02e32f4cffd768cfe327c73",
+ "reference": "0017dd92ac8cb619f02e32f4cffd768cfe327c73",
+ "shasum": ""
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.5.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "N98\\JUnitXml\\": "src/N98/JUnitXml"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Christian Münch",
+ "email": "c.muench@netz98.de"
+ }
+ ],
+ "description": "JUnit XML Document generation library",
+ "support": {
+ "issues": "https://github.com/cmuench/junit-xml/issues",
+ "source": "https://github.com/cmuench/junit-xml/tree/1.1.0"
+ },
+ "time": "2020-12-25T09:08:58+00:00"
+ },
+ {
+ "name": "overtrue/phplint",
+ "version": "3.0.6",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/overtrue/phplint.git",
+ "reference": "b4212c2c65bf50f6c823ab8e7c13c9ead9433241"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/overtrue/phplint/zipball/b4212c2c65bf50f6c823ab8e7c13c9ead9433241",
+ "reference": "b4212c2c65bf50f6c823ab8e7c13c9ead9433241",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "n98/junit-xml": "1.1.0",
+ "php": ">=5.5.9",
+ "symfony/console": "^3.2|^4.0|^5.0",
+ "symfony/finder": "^3.0|^4.0|^5.0",
+ "symfony/process": "^3.3|^4.0|^5.0",
+ "symfony/yaml": "^3.0|^4.0|^5.0"
+ },
+ "require-dev": {
+ "brainmaestro/composer-git-hooks": "^2.7",
+ "friendsofphp/php-cs-fixer": "^2.16",
+ "jakub-onderka/php-console-highlighter": "^0.3.2 || ^0.4"
+ },
+ "bin": [
+ "bin/phplint"
+ ],
+ "type": "library",
+ "extra": {
+ "hooks": {
+ "pre-commit": [
+ "composer fix-style"
+ ],
+ "pre-push": [
+ "composer check-style"
+ ]
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Overtrue\\PHPLint\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "overtrue",
+ "email": "anzhengchao@gmail.com"
+ }
+ ],
+ "description": "`phplint` is a tool that can speed up linting of php files by running several lint processes at once.",
+ "keywords": [
+ "check",
+ "lint",
+ "phplint",
+ "syntax"
+ ],
+ "support": {
+ "issues": "https://github.com/overtrue/phplint/issues",
+ "source": "https://github.com/overtrue/phplint/tree/3.0.6"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/overtrue",
+ "type": "github"
+ }
+ ],
+ "time": "2021-11-30T15:45:02+00:00"
+ },
+ {
"name": "phar-io/manifest",
"version": "2.0.1",
"source": {
@@ -6728,5 +6844,5 @@
"ext-mbstring": "*"
},
"platform-dev": [],
- "plugin-api-version": "2.1.0"
+ "plugin-api-version": "2.3.0"
}
diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml
new file mode 100644
index 0000000..0306f2c
--- /dev/null
+++ b/docker-compose-dev.yml
@@ -0,0 +1,50 @@
+version: "3.7"
+
+services:
+ db:
+ image: mariadb:10.4
+ volumes:
+ - db_data:/var/lib/mysql
+ command: mysqld --sql_mode=""
+ restart: always
+ environment:
+ MYSQL_RANDOM_ROOT_PASSWORD: 1
+ MYSQL_DATABASE: studip_db
+ MYSQL_USER: studip_user
+ MYSQL_PASSWORD: studip_password
+
+ web:
+ build:
+ context: .
+ dockerfile: ./docker/studip/Dockerfile-Dev
+
+ depends_on:
+ - db
+ volumes:
+ - .:/var/www/studip:rw
+
+ # Use port to redirect port
+ ports:
+ - "8032:80"
+
+ restart: always
+ environment:
+ MYSQL_DATABASE: studip_db
+ MYSQL_USER: studip_user
+ MYSQL_PASSWORD: studip_password
+ MYSQL_HOST: db
+ STUDIP_MAIL_TRANSPORT: debug
+
+ # Use automigrate to migrate your instance on startup
+ AUTO_MIGRATE: 1
+
+ # Use proxy url OR autoproxy if run behind a proxy
+ # PROXY_URL: https://studip.example.com/
+ # AUTO_PROXY: 1
+
+ # Demo data for your studip instance
+ DEMO_DATA: 1
+
+volumes:
+ web_data: {}
+ db_data: {}
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..82c4bc4
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,49 @@
+version: "3"
+services:
+ db:
+ image: mariadb:10.4
+ volumes:
+ - db_data:/var/lib/mysql
+ command: mysqld --sql_mode=""
+ restart: always
+ environment:
+ MYSQL_RANDOM_ROOT_PASSWORD: 1
+ MYSQL_DATABASE: studip_db
+ MYSQL_USER: studip_user
+ MYSQL_PASSWORD: studip_password
+
+ web:
+ build:
+ context: .
+ dockerfile: ./docker/studip/Dockerfile
+
+ depends_on:
+ - db
+ volumes:
+ - web_data:/var/www/studip/data
+
+ # Use port to redirect port
+ ports:
+ - "8032:80"
+
+ restart: always
+ environment:
+ MYSQL_DATABASE: studip_db
+ MYSQL_USER: studip_user
+ MYSQL_PASSWORD: studip_password
+ MYSQL_HOST: db
+ STUDIP_MAIL_TRANSPORT: debug
+
+ # Use automigrate to migrate your instance on startup
+ AUTO_MIGRATE: 1
+
+ # Use proxy url OR autoproxy if run behind a proxy
+ # PROXY_URL: https://studip.example.com/
+ # AUTO_PROXY: 1
+
+ # Demo data for your studip instance
+ DEMO_DATA: 1
+
+volumes:
+ web_data: {}
+ db_data: {}
diff --git a/docker/Readme.md b/docker/Readme.md
new file mode 100644
index 0000000..a4a2a71
--- /dev/null
+++ b/docker/Readme.md
@@ -0,0 +1,9 @@
+# How to build ci images
+
+Use the script `build_images.sh` to build all relevant images for ci pipeline
+You can trigger an automated push to the studip docker repository by providing the string "push" as first argument. (Permission to push to hub.docker.com/studip is required)
+
+`./build_images.sh push`
+
+All images are automatically built for linux/amd64
+\ No newline at end of file \ No newline at end of file
diff --git a/docker/build_images.sh b/docker/build_images.sh
new file mode 100644
index 0000000..1fb09f6
--- /dev/null
+++ b/docker/build_images.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+PUSH=$1
+
+build_image () {
+ docker build -t studip/$2 --platform=linux/amd64 -f $1/Dockerfile .
+ if [[ $PUSH = 'push' ]]; then
+ docker push studip/$2
+ fi
+}
+
+build_image tests/php72 studip:tests-php7.2 &
+build_image tests/php74 studip:tests &
+build_image release-cli release-cli &
+wait
+
+echo "Images built" \ No newline at end of file
diff --git a/docker/release-cli/Dockerfile b/docker/release-cli/Dockerfile
new file mode 100644
index 0000000..4e41152
--- /dev/null
+++ b/docker/release-cli/Dockerfile
@@ -0,0 +1,6 @@
+FROM alpine
+
+RUN apk --no-cache add jq bash curl grep
+
+ADD https://release-cli-downloads.s3.amazonaws.com/latest/release-cli-linux-amd64 /usr/bin/release-cli
+RUN chmod u+x /usr/bin/release-cli \ No newline at end of file
diff --git a/docker/studip/Dockerfile b/docker/studip/Dockerfile
new file mode 100644
index 0000000..ec20ce1
--- /dev/null
+++ b/docker/studip/Dockerfile
@@ -0,0 +1,60 @@
+# Setup php, apache and stud.ip
+FROM php:7.4-apache as base
+
+# Install system requirements
+RUN apt update && apt install -y --no-install-recommends \
+ default-mysql-client \
+ default-libmysqlclient-dev \
+ libcurl4-openssl-dev zlib1g-dev \
+ libpng-dev \
+ libjpeg-dev \
+ libonig-dev \
+ libzip-dev \
+ libicu-dev \
+ vim \
+ && rm -rf /var/lib/apt/lists/*
+
+# Install php extensions
+RUN docker-php-ext-configure gd --with-jpeg
+RUN docker-php-ext-install pdo gettext curl gd mbstring zip pdo pdo_mysql mysqli intl json
+
+FROM node:12 as nodejs
+
+# Install node modules
+COPY . /studip
+WORKDIR /studip
+RUN make webpack-prod
+
+FROM base as build
+
+# Install composer
+COPY --from=composer /usr/bin/composer /usr/bin/composer
+
+# Copy studip
+COPY --from=nodejs /studip /studip
+
+# Execute make to install composer dependencies and build assets
+WORKDIR /studip
+RUN make composer
+
+FROM base
+
+# Reconfigure apache
+ENV APACHE_DOCUMENT_ROOT /var/www/studip/public
+RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
+RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
+
+COPY --from=build /studip /var/www/studip
+
+WORKDIR /var/www/studip
+
+# Add config template
+COPY ./docker/studip/config_local.php ./config/config_local.inc.php
+
+# Add custom entrypoint
+COPY ./docker/studip/docker-entrypoint.sh /usr/local/bin/
+RUN chmod u+x /usr/local/bin/docker-entrypoint.sh
+
+# Set start parameters
+ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
+CMD ["apache2-foreground"] \ No newline at end of file
diff --git a/docker/studip/Dockerfile-Dev b/docker/studip/Dockerfile-Dev
new file mode 100644
index 0000000..960bd97
--- /dev/null
+++ b/docker/studip/Dockerfile-Dev
@@ -0,0 +1,38 @@
+# Setup php, apache and stud.ip
+FROM php:7.4-apache as base
+
+# Install system requirements
+RUN apt update && apt install -y --no-install-recommends \
+ default-mysql-client \
+ default-libmysqlclient-dev \
+ libcurl4-openssl-dev zlib1g-dev \
+ libpng-dev \
+ libjpeg-dev \
+ libonig-dev \
+ libzip-dev \
+ libicu-dev \
+ vim \
+ && rm -rf /var/lib/apt/lists/*
+
+# Install php extensions
+RUN docker-php-ext-configure gd --with-jpeg
+RUN docker-php-ext-install pdo gettext curl gd mbstring zip pdo pdo_mysql mysqli intl json
+
+
+# Reconfigure apache
+ENV APACHE_DOCUMENT_ROOT /var/www/studip/public
+RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
+RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
+
+WORKDIR /var/www/studip
+
+# Add config template
+ADD ./docker/studip/config_local.php ./config/config_local.inc.php
+
+# Add custom entrypoint
+COPY ./docker/studip/docker-entrypoint.sh /usr/local/bin/
+RUN chmod u+x /usr/local/bin/docker-entrypoint.sh
+
+# Set start parameters
+ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
+CMD ["apache2-foreground"] \ No newline at end of file
diff --git a/docker/studip/config_local.php b/docker/studip/config_local.php
new file mode 100644
index 0000000..df8187a
--- /dev/null
+++ b/docker/studip/config_local.php
@@ -0,0 +1,46 @@
+<?php
+/*basic settings for Stud.IP
+----------------------------------------------------------------
+you find here the basic system settings. You shouldn't have to touch much of them...
+please note the CONFIG.INC.PHP for the indivual settings of your installation!*/
+
+namespace Studip {
+ //const ENV = 'development';
+ define ('ENV', getenv('ENV') ?? 'development');
+}
+
+namespace {
+ /*settings for database access
+ ----------------------------------------------------------------
+ please fill in your database connection settings.
+ */
+
+ // default Stud.IP database (DB_Seminar)
+ $DB_STUDIP_HOST = getenv('MYSQL_HOST');
+ $DB_STUDIP_USER = getenv('MYSQL_USER');
+ $DB_STUDIP_PASSWORD = getenv('MYSQL_PASSWORD');
+ $DB_STUDIP_DATABASE = getenv('MYSQL_DATABASE');
+
+ /*URL
+ ----------------------------------------------------------------
+ customize if automatic detection fails, e.g. when installation is hidden
+ behind a proxy
+ */
+ //$CANONICAL_RELATIVE_PATH_STUDIP = '/';
+ //$ABSOLUTE_URI_STUDIP = 'https://www.studip.de/';
+ //$ASSETS_URL = 'https://www.studip.de/assets/';
+
+ // Set proxy url
+ if ($PROXY_URL = getenv('PROXY_URL')) {
+ $ABSOLUTE_URI_STUDIP = $PROXY_URL;
+ $ASSETS_URL = $PROXY_URL.'/assets/';
+ unset($PROXY_URL);
+ }
+
+ // Use autoproxy
+ if (getenv('AUTO_PROXY')) {
+ $ABSOLUTE_URI_STUDIP = $_SERVER['HTTP_X_FORWARDED_PROTO'].'://'.$_SERVER['HTTP_X_FORWARDED_HOST'].'/';
+ $ASSETS_URL = $ABSOLUTE_URI_STUDIP.'/assets/';
+ }
+ $MAIL_TRANSPORT = getenv('STUDIP_MAIL_TRANSPORT');
+} \ No newline at end of file
diff --git a/docker/studip/docker-entrypoint.sh b/docker/studip/docker-entrypoint.sh
new file mode 100644
index 0000000..bafc2fe
--- /dev/null
+++ b/docker/studip/docker-entrypoint.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+set -e
+
+STUDIP='/var/www/studip'
+CONFIGFILE="$STUDIP/config/config_local.inc.php"
+DOCKERCONFIGFILE="/config/config_local.inc.php"
+CONF="$STUDIP/config/config.inc.php"
+
+# Check if we have a config
+if [ ! -f $CONFIGFILE ]; then
+ echo "Setting up new config"
+ cp "$DOCKERCONFIGFILE" "$CONFIGFILE"
+ cp "$CONF.dist" "$CONF"
+fi
+
+# wait until MySQL is really available
+maxcounter=45
+
+counter=1
+while ! mysql -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD -e "show databases;" > /dev/null 2>&1; do
+ sleep 1
+ counter=`expr $counter + 1`
+ if [ $counter -gt $maxcounter ]; then
+ echo "We have been waiting for MySQL too long already; failing." >&2
+ exit 1
+ fi;
+done
+
+sh $STUDIP/.gitlab/scripts/install_db.sh
+
+if [ ! -z $AUTO_MIGRATE ]; then
+ echo "Migrate Instance"
+ # If migrate fails start instance anyway
+ php "$STUDIP/cli/studip migrate" || true
+ echo "Migration finished"
+fi
+
+# first arg is `-f` or `--some-option`
+if [ "${1#-}" != "$1" ]; then
+ set -- apache2-foreground "$@"
+fi
+
+exec "$@"
+
diff --git a/docker/tests/php72/Dockerfile b/docker/tests/php72/Dockerfile
new file mode 100644
index 0000000..796d064
--- /dev/null
+++ b/docker/tests/php72/Dockerfile
@@ -0,0 +1,24 @@
+# Setup php, apache and stud.ip
+FROM php:7.2-cli
+
+# Install system requirements
+RUN apt update && apt install -y --no-install-recommends \
+ default-mysql-client default-libmysqlclient-dev libcurl4-openssl-dev zlib1g-dev libpng-dev libjpeg-dev libonig-dev libzip-dev libicu-dev \
+ lsb-release \
+ zip \
+ tar \
+ && rm -rf /var/lib/apt/lists/*
+
+# Install php extensions
+RUN docker-php-ext-configure gd --with-png-dir=/usr/include/ \
+ --with-jpeg-dir=/usr/include/
+RUN docker-php-ext-install pdo gettext curl gd mbstring zip pdo pdo_mysql mysqli intl json
+
+# Install npm using nvm
+RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
+RUN apt update && apt install -y --no-install-recommends nodejs \
+ curl apt-transport-https ca-certificates gnupg unzip git \
+ && rm -rf /var/lib/apt/lists/*
+
+# Install composer
+COPY --from=composer /usr/bin/composer /usr/bin/composer
diff --git a/docker/tests/php74/Dockerfile b/docker/tests/php74/Dockerfile
new file mode 100644
index 0000000..7d77515
--- /dev/null
+++ b/docker/tests/php74/Dockerfile
@@ -0,0 +1,23 @@
+# Setup php, apache and stud.ip
+FROM php:7.4-cli
+
+# Install system requirements
+RUN apt update && apt install -y --no-install-recommends \
+ default-mysql-client default-libmysqlclient-dev libcurl4-openssl-dev zlib1g-dev libpng-dev libjpeg-dev libonig-dev libzip-dev libicu-dev \
+ lsb-release \
+ zip \
+ tar \
+ && rm -rf /var/lib/apt/lists/*
+
+# Install php extensions
+RUN docker-php-ext-configure gd --with-jpeg
+RUN docker-php-ext-install pdo gettext curl gd mbstring zip pdo pdo_mysql mysqli intl json
+
+# Install npm using nvm
+RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
+RUN apt update && apt install -y --no-install-recommends nodejs \
+ curl apt-transport-https ca-certificates gnupg unzip git \
+ && rm -rf /var/lib/apt/lists/*
+
+# Install composer
+COPY --from=composer /usr/bin/composer /usr/bin/composer