feat: add initial fileset for 2.24.1

This commit is contained in:
Oleg Kainov 2020-05-17 16:14:40 +02:00
parent e82159cf86
commit 32579a5ed3
No known key found for this signature in database
GPG Key ID: EF91AC1A014D0028
5 changed files with 134 additions and 0 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
# Use .dockerignore as whitelist
*
!mantis-entrypoint*
!config_inc.php

53
Dockerfile Normal file
View File

@ -0,0 +1,53 @@
FROM php:7.4-apache
RUN a2enmod rewrite
RUN set -xe \
&& apt-get update \
&& apt-get install -y \
# PHP dependencies
libfreetype6-dev libpng-dev libjpeg-dev libpq-dev libxml2-dev \
# New in PHP 7.4, required for mbstring, see https://github.com/docker-library/php/issues/880
libonig-dev \
# To clone plugins
git \
&& docker-php-ext-configure gd --with-jpeg --with-freetype \
&& docker-php-ext-install gd mbstring mysqli soap \
&& rm -rf /var/lib/apt/lists/*
ENV MANTIS_VER 2.24.1
ENV MANTIS_MD5 a5a001ffa5a9c9a55848de1fbf7fae95
ENV MANTIS_URL https://sourceforge.net/projects/mantisbt/files/mantis-stable/${MANTIS_VER}/mantisbt-${MANTIS_VER}.tar.gz
ENV MANTIS_FILE mantisbt.tar.gz
# Install MantisBT itself
RUN set -xe \
&& curl -fSL ${MANTIS_URL} -o ${MANTIS_FILE} \
&& md5sum ${MANTIS_FILE} \
&& echo "${MANTIS_MD5} ${MANTIS_FILE}" | md5sum -c \
&& tar -xz --strip-components=1 -f ${MANTIS_FILE} \
&& rm ${MANTIS_FILE} \
&& rm -r doc \
&& chown -R www-data:www-data . \
# Apply PHP and config fixes
# Use the default production configuration
&& mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
&& echo 'mysqli.allow_local_infile = Off' >> $PHP_INI_DIR/conf.d/mantis.php.ini \
&& echo 'display_errors = Off ' >> $PHP_INI_DIR/conf.d/mantis.php.ini \
&& echo 'log_errors = On ' >> $PHP_INI_DIR/conf.d/mantis.php.ini \
&& echo 'error_log = /dev/stderr' >> $PHP_INI_DIR/conf.d/mantis.php.ini \
&& echo 'register_argc_argv = Off' >> $PHP_INI_DIR/conf.d/mantis.php.ini
COPY config_inc.php /var/www/html/config/config_inc.php
# Install additional plugins
# TODO: copy from multi-stage to remove git dependency
ENV SOURCE_TAG v2.3.1
RUN set -xe && \
git clone --branch $SOURCE_TAG --depth 1 https://github.com/mantisbt-plugins/source-integration.git /tmp/source && \
cp -r /tmp/source/Source /tmp/source/SourceGitlab /tmp/source/SourceGithub /var/www/html/plugins/ && \
rm -r /tmp/source
ADD ./mantis-entrypoint /usr/local/bin/mantis-entrypoint
CMD ["mantis-entrypoint"]

23
config_inc.php Normal file
View File

@ -0,0 +1,23 @@
<?php
$g_db_type = 'mysqli';
$g_hostname = getenv('MYSQL_HOST') !== false ? getenv('MYSQL_HOST') : 'db';
$g_database_name = getenv('MYSQL_DATABASE') !== false ? getenv('MYSQL_DATABASE') : 'bugtracker';
$g_db_username = getenv('MYSQL_USER') !== false ? getenv('MYSQL_USER') : 'mantis';
$g_db_password = getenv('MYSQL_PASSWORD') !== false ? getenv('MYSQL_PASSWORD') : 'mantis';
$g_crypto_master_salt = getenv('MASTER_SALT');
# To fix the warning
# max_file_size MantisBT option is less than or equal to the upload_max_filesize directive in php.ini
$g_max_file_size = ini_get("upload_max_filesize");
# Configure email
$g_webmaster_email = getenv('EMAIL_WEBMASTER') !== false ? getenv('EMAIL_WEBMASTER') : null;
$g_from_email = getenv('EMAIL_FROM') !== false ? getenv('EMAIL_FROM') : null;
$g_return_path_email = getenv('EMAIL_RETURN_PATH') !== false ? getenv('EMAIL_RETURN_PATH') : null;
include 'config_inc_addon.php';

41
docker-compose.yaml Normal file
View File

@ -0,0 +1,41 @@
version: "3"
services:
web:
# Pin the version for production usage!
#image: okainov/mantisbt:latest
build: .
container_name: mantis_web
ports:
- "8989:80"
environment:
# Comment or set to 0 in production!
- MANTIS_ENABLE_ADMIN=1
# Set master salt, typically can be generated by `cat /dev/urandom | head -c 64 | base64`
#- MASTER_SALT=
# Uncomment only if modified from default values
#- MYSQL_HOST=db
#- MYSQL_DATABASE=bugtracker
#- MYSQL_USER=mantis
#- MYSQL_PASSWORD=mantis
# If you need to customize more options in config, create `config_inc_addon.php` and uncomment lines below
# This file will be included from the main config.
#volumes:
# - ./config_inc_addon.php:/var/www/html/config/config_inc_addon.php
depends_on:
- db
restart: always
db:
image: mysql:5.7
container_name: mantis_db
volumes:
- ./db_data:/var/lib/mysql
environment:
# You might want to change root password before first run
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=bugtracker
- MYSQL_USER=mantis
- MYSQL_PASSWORD=mantis
# Set default collation so Mantis does not complain about latin1
command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']

12
mantis-entrypoint Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
set -eo pipefail
test -d admin && chmod -rx admin && mv admin .admin
# If MANTIS_ENABLE_ADMIN is set to , then enable 'admin' folder
if [ ! -z "$MANTIS_ENABLE_ADMIN" ] && [ "$MANTIS_ENABLE_ADMIN" -ne "0" ]; then
test -d .admin && mv .admin admin && chmod +rx admin
fi
apache2-foreground