mirror of
https://github.com/mykitserver/docker-limesurvey.git
synced 2025-12-06 16:39:11 +01:00
Add fpm-alpine Dockerfile
This commit is contained in:
committed by
Markus Opolka
parent
cd8f4b825e
commit
af02bb1f8c
@@ -9,3 +9,5 @@ matrix:
|
|||||||
script: cd apache; docker build -q -t $TAG . && cd ..; ./tests/run.sh $TAG
|
script: cd apache; docker build -q -t $TAG . && cd ..; ./tests/run.sh $TAG
|
||||||
- env: TAG=martialblog/limesurvey-fpm
|
- env: TAG=martialblog/limesurvey-fpm
|
||||||
script: cd fpm; docker build -q -t $TAG . && cd ..; ./tests/run.sh $TAG
|
script: cd fpm; docker build -q -t $TAG . && cd ..; ./tests/run.sh $TAG
|
||||||
|
- env: TAG=martialblog/limesurvey-alpine
|
||||||
|
script: cd fpm; docker build -q -t $TAG . && cd ..; ./tests/run.sh $TAG
|
||||||
|
|||||||
35
docker-compose.fpm.alpine.yml
Normal file
35
docker-compose.fpm.alpine.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
version: "3.0"
|
||||||
|
services:
|
||||||
|
limesurvey:
|
||||||
|
build:
|
||||||
|
context: fpm-alpine/
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
volumes:
|
||||||
|
- /tmp/upload/:/var/www/html/upload/
|
||||||
|
- lime:/var/www/html
|
||||||
|
links:
|
||||||
|
- lime-db
|
||||||
|
depends_on:
|
||||||
|
- lime-db
|
||||||
|
environment:
|
||||||
|
- "DB_HOST=docker-limesurvey_lime-db_1"
|
||||||
|
- "DB_PASSWORD=secret"
|
||||||
|
- "ADMIN_PASSWORD=foobar"
|
||||||
|
lime-web:
|
||||||
|
image: nginx:alpine
|
||||||
|
links:
|
||||||
|
- limesurvey
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
volumes:
|
||||||
|
- ./examples/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||||
|
- lime:/var/www/html
|
||||||
|
lime-db:
|
||||||
|
image: mysql:5.7
|
||||||
|
environment:
|
||||||
|
- "MYSQL_USER=limesurvey"
|
||||||
|
- "MYSQL_DATABASE=limesurvey"
|
||||||
|
- "MYSQL_PASSWORD=secret"
|
||||||
|
- "MYSQL_ROOT_PASSWORD=secret"
|
||||||
|
volumes:
|
||||||
|
lime:
|
||||||
41
fpm-alpine/Dockerfile
Normal file
41
fpm-alpine/Dockerfile
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
FROM php:7.2-fpm-alpine
|
||||||
|
LABEL maintainer="markus@martialblog.de"
|
||||||
|
ARG version='3.14.2+180807'
|
||||||
|
|
||||||
|
# Install OS dependencies
|
||||||
|
RUN apk add --no-cache --virtual .build-deps \
|
||||||
|
libpng-dev \
|
||||||
|
openldap-dev \
|
||||||
|
imap-dev \
|
||||||
|
postgresql-dev && \
|
||||||
|
apk add --no-cache netcat-openbsd bash
|
||||||
|
|
||||||
|
# Install PHP Plugins
|
||||||
|
RUN docker-php-ext-configure imap --with-imap-ssl && \
|
||||||
|
docker-php-ext-install \
|
||||||
|
gd \
|
||||||
|
imap \
|
||||||
|
ldap \
|
||||||
|
mbstring \
|
||||||
|
pdo \
|
||||||
|
pdo_mysql \
|
||||||
|
pdo_pgsql \
|
||||||
|
pgsql \
|
||||||
|
zip
|
||||||
|
|
||||||
|
# Download, unzip and chmod of LimeSurvey
|
||||||
|
ADD "https://github.com/LimeSurvey/LimeSurvey/archive/${version}.tar.gz" /tmp
|
||||||
|
|
||||||
|
RUN tar xzvf "/tmp/${version}.tar.gz" --strip-components=1 -C /var/www/html/ && \
|
||||||
|
rm -rf "/tmp/${version}.tar.gz" \
|
||||||
|
/var/www/html/docs \
|
||||||
|
/var/www/html/tests \
|
||||||
|
/var/www/html/*.md && \
|
||||||
|
chown -R www-data:root /var/www/ ; \
|
||||||
|
chmod -R g=u /var/www
|
||||||
|
|
||||||
|
EXPOSE 9000
|
||||||
|
|
||||||
|
COPY entrypoint.sh entrypoint.sh
|
||||||
|
ENTRYPOINT ["/var/www/html/entrypoint.sh"]
|
||||||
|
CMD ["php-fpm"]
|
||||||
91
fpm-alpine/entrypoint.sh
Executable file
91
fpm-alpine/entrypoint.sh
Executable file
@@ -0,0 +1,91 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Entrypoint for Docker Container
|
||||||
|
|
||||||
|
|
||||||
|
DB_TYPE=${DB_TYPE:-'mysql'}
|
||||||
|
DB_HOST=${DB_HOST:-'mysql'}
|
||||||
|
DB_PORT=${DB_PORT:-'3306'}
|
||||||
|
DB_NAME=${DB_NAME:-'limesurvey'}
|
||||||
|
DB_TABLE_PREFIX=${DB_TABLE_PREFIX:-'lime_'}
|
||||||
|
DB_USERNAME=${DB_USERNAME:-'limesurvey'}
|
||||||
|
DB_PASSWORD=${DB_PASSWORD:-}
|
||||||
|
|
||||||
|
ADMIN_USER=${ADMIN_USER:-'admin'}
|
||||||
|
ADMIN_NAME=${ADMIN_NAME:-'admin'}
|
||||||
|
ADMIN_EMAIL=${ADMIN_EMAIL:-'foobar@example.com'}
|
||||||
|
ADMIN_PASSWORD=${ADMIN_PASSWORD:-'-'}
|
||||||
|
|
||||||
|
PUBLIC_URL=${PUBLIC_URL:-}
|
||||||
|
URL_FORMAT=${URL_FORMAT:-'path'}
|
||||||
|
|
||||||
|
|
||||||
|
# Check if database is available
|
||||||
|
until nc -z -v -w30 $DB_HOST $DB_PORT
|
||||||
|
do
|
||||||
|
echo "Info: Waiting for database connection..."
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# Check if already provisioned
|
||||||
|
if [ -f application/config/config.php ]; then
|
||||||
|
echo 'Info: config.php already provisioned'
|
||||||
|
else
|
||||||
|
echo 'Info: Generating config.php'
|
||||||
|
|
||||||
|
if [ "$DB_TYPE" = 'mysql' ]; then
|
||||||
|
echo 'Info: Using MySQL configuration'
|
||||||
|
DB_CHARSET=${DB_CHARSET:-'utf8mb4'}
|
||||||
|
cp application/config/config-sample-mysql.php application/config/config.php
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$DB_TYPE" = 'pgsql' ]; then
|
||||||
|
echo 'Info: Using PostgreSQL configuration'
|
||||||
|
DB_CHARSET=${DB_CHARSET:-'utf8'}
|
||||||
|
cp application/config/config-sample-pgsql.php application/config/config.php
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set Database config
|
||||||
|
sed -i "s#\('connectionString' => \).*,\$#\\1'${DB_TYPE}:host=${DB_HOST};port=${DB_PORT};dbname=${DB_NAME};',#g" application/config/config.php
|
||||||
|
sed -i "s#\('username' => \).*,\$#\\1'${DB_USERNAME}',#g" application/config/config.php
|
||||||
|
sed -i "s#\('password' => \).*,\$#\\1'${DB_PASSWORD}',#g" application/config/config.php
|
||||||
|
sed -i "s#\('charset' => \).*,\$#\\1'${DB_CHARSET}',#g" application/config/config.php
|
||||||
|
sed -i "s#\('tablePrefix' => \).*,\$#\\1'${DB_TABLE_PREFIX}',#g" application/config/config.php
|
||||||
|
|
||||||
|
# Set URL config
|
||||||
|
sed -i "s#\('urlFormat' => \).*,\$#\\1'${URL_FORMAT}',#g" application/config/config.php
|
||||||
|
|
||||||
|
# Set Public URL
|
||||||
|
if [ -z "$PUBLIC_URL" ]; then
|
||||||
|
echo 'Info: Setting PublicURL'
|
||||||
|
sed -i "s#\('debug'=>0,\)\$#'publicurl'=>'${PUBLIC_URL}',\n\t\t\\1 #g" application/config/config.php
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Check if LimeSurvey database is provisioned
|
||||||
|
echo 'Info: Check if database already provisioned. Nevermind the Stack trace.'
|
||||||
|
php application/commands/console.php updatedb
|
||||||
|
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo 'Info: Database already provisioned'
|
||||||
|
else
|
||||||
|
# Check if DB_PASSWORD is set
|
||||||
|
if [ -z "$DB_PASSWORD" ]; then
|
||||||
|
echo >&2 'Error: Missing DB_PASSWORD'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if DB_PASSWORD is set
|
||||||
|
if [ -z "$ADMIN_PASSWORD" ]; then
|
||||||
|
echo >&2 'Error: Missing ADMIN_PASSWORD'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ''
|
||||||
|
echo 'Running console.php install'
|
||||||
|
php application/commands/console.php install $ADMIN_USER $ADMIN_PASSWORD $ADMIN_NAME $ADMIN_EMAIL
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
Reference in New Issue
Block a user