Skip to content
Snippets Groups Projects
Commit 2772fa12 authored by Florian Bieringer's avatar Florian Bieringer
Browse files

Merge branch 'nightly'

parents 5681bcbc 97168872
No related branches found
No related tags found
No related merge requests found
.vscode/
docker-compose.override.yml
\ No newline at end of file
# Setup php, apache and stud.ip
FROM php:7.4-apache
FROM php:7.4-apache as base
# Install system requirements
RUN apt update && apt install -y --no-install-recommends \
subversion default-mysql-client default-libmysqlclient-dev libcurl4-openssl-dev zlib1g-dev libpng-dev libonig-dev libzip-dev libicu-dev unzip git \
curl apt-transport-https ca-certificates lsb-release gnupg \
default-mysql-client default-libmysqlclient-dev libcurl4-openssl-dev zlib1g-dev libpng-dev libonig-dev libzip-dev libicu-dev \
&& rm -rf /var/lib/apt/lists/*
# Install php extensions
RUN docker-php-ext-install pdo gettext curl gd mbstring zip pdo pdo_mysql mysqli intl json
FROM base as build
# Install build dependancies
RUN apt update && apt install -y --no-install-recommends \
subversion lsb-release \
&& rm -rf /var/lib/apt/lists/*
# 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 composer.sh /tmp/composer.sh
RUN chmod u+x /tmp/composer.sh
RUN /tmp/composer.sh
COPY --from=composer /usr/bin/composer /usr/bin/composer
# Branch Arg
ARG BRANCH=branches/4.6
# Checkout studip
RUN svn export --username=studip --password=studip --non-interactive "svn://develop.studip.de/studip/$BRANCH" /var/www/studip
RUN svn export --username=studip --password=studip --non-interactive "svn://develop.studip.de/studip/$BRANCH" /studip
# Execute make to install composer dependencies and build assets
WORKDIR /studip
RUN npm install && composer install
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
# Execute make to install composer dependencies and build assets
COPY --from=build /studip /var/www/studip
WORKDIR /var/www/studip
RUN make
# Add config template
COPY config_local.php /var/www/studip/config/config_local.inc.php.dist.docker
COPY config_local.php /config/config_local.inc.php
# Add custom entrypoint
COPY docker-entrypoint.sh /usr/local/bin/
......
#!/bin/sh
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
php composer-setup.php --install-dir=/usr/local/bin --filename composer --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT
\ No newline at end of file
......@@ -6,6 +6,7 @@ services:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_RANDOM_ROOT_PASSWORD: 1
MYSQL_DATABASE: studip_db
MYSQL_USER: studip_user
MYSQL_PASSWORD: studip_password
......@@ -32,5 +33,8 @@ services:
# PROXY_URL: https://studip.example.com/
# AUTO_PROXY: 1
# Demo data for your studip instance
DEMO_DATA: 1
volumes:
db_data: {}
......@@ -3,17 +3,16 @@ 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 "$CONFIGFILE.dist.docker" "$CONFIGFILE"
cp "$DOCKERCONFIGFILE" "$CONFIGFILE"
cp "$CONF.dist" "$CONF"
# Setup mysql database
echo "INSTALL DB"
fi
# wait until MySQL is really available
maxcounter=45
......@@ -28,6 +27,11 @@ if [ ! -f $CONFIGFILE ]; then
fi;
done
# Check if the connected database has tables, otherwise install the database
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 < ${STUDIP}/db/studip.sql
echo "INSTALL DEFAULT DATA"
mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE < ${STUDIP}/db/studip_default_data.sql
......@@ -36,10 +40,15 @@ if [ ! -f $CONFIGFILE ]; then
echo "INSTALL ROOTUSER"
mysql -f -u $MYSQL_USER -h $MYSQL_HOST -p$MYSQL_PASSWORD $MYSQL_DATABASE < ${STUDIP}/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 < ${STUDIP}/db/studip_demo_data.sql
fi
echo "INSTALLATION FINISHED"
else
echo "Found some SQL table. Skipping installation"
fi
if [ ! -z $AUTO_MIGRATE ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment