aboutsummaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2023-02-09 10:57:24 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2023-02-09 10:57:24 +0000
commit9c9a398d27949e29422e2ef5621911c886d8dd18 (patch)
tree5a3d89501923b03127d9bf071c1b9ec3c6ca3abe /docker
parent880749963518e8d07608d75372ffe54a5e062f76 (diff)
5.1: adjust gitlab ci pipeline configuring to include checks and tests, re #2116biest-02063
Merge request studip/studip!1372
Diffstat (limited to 'docker')
-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.php47
-rw-r--r--docker/studip/docker-entrypoint.sh44
5 files changed, 195 insertions, 0 deletions
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..de3a4b1
--- /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:14 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"]
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..4e77ed8
--- /dev/null
+++ b/docker/studip/config_local.php
@@ -0,0 +1,47 @@
+<?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');
+ $MAIL_TRANSPORT = getenv('MAIL_TRANSPORT');
+
+ /*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 "$@"
+