complete rebuild using php5, can stand trimming some dependencies

This commit is contained in:
sparklyballs 2017-05-01 23:02:58 +01:00
parent 0a5908757b
commit fa4a6dd6bc
6 changed files with 127 additions and 203 deletions

View File

@ -1,4 +1,4 @@
FROM lsiobase/alpine.nginx:3.5
FROM lsiobase/alpine:3.5
MAINTAINER sparklyballs
# set version label
@ -6,46 +6,84 @@ ARG BUILD_DATE
ARG VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
# environment settings
ENV PHP_MEMORY_LIMIT 512M
ENV MAX_UPLOAD 50M
ENV PHP_MAX_FILE_UPLOAD 200
ENV PHP_MAX_POST 100M
# install packages
RUN \
apk add --no-cache --virtual=build-dependencies \
apk add --no-cache \
apache2 \
apache2-utils \
curl \
tar && \
apk add --no-cache \
--repository http://nl.alpinelinux.org/alpine/edge/main \
libwebp && \
apk add --no-cache \
--repository http://nl.alpinelinux.org/alpine/edge/community \
php7-gd \
php7-ldap \
php7-mcrypt \
php7-pdo_mysql \
php7-xml \
php7-xmlrpc && \
php5-apache2 \
php5-apcu \
php5-bcmath \
php5-bz2 \
php5-cli \
php5-ctype \
php5-curl \
php5-dom \
php5-gd \
php5-gettext \
php5-gmp \
php5-iconv \
php5-json \
php5-mcrypt \
php5-memcache \
php5-mssql \
php5-mysql \
php5-odbc \
php5-openssl \
php5-pdo \
php5-pdo_dblib \
php5-pdo_mysql \
php5-pdo_odbc \
php5-pdo_pgsql \
php5-pdo_sqlite \
php5-phar \
php5-soap \
php5-sqlite3 \
php5-xcache \
php5-xmlreader \
php5-xmlrpc \
php5-zip \
tar \
wget && \
# configure php
sed -i \
-e "s|;*memory_limit =.*|memory_limit = ${PHP_MEMORY_LIMIT}|i" \
-e "s|;*upload_max_filesize =.*|upload_max_filesize = ${MAX_UPLOAD}|i" \
-e "s|;*max_file_uploads =.*|max_file_uploads = ${PHP_MAX_FILE_UPLOAD}|i" \
-e "s|;*post_max_size =.*|post_max_size = ${PHP_MAX_POST}|i" /etc/php5/php.ini \
-e "s|;*cgi.fix_pathinfo=.*|cgi.fix_pathinfo= 0|i" \
/etc/php5/php.ini && \
# configure apache2
sed -i \
-e 's#User apache#User abc#g' \
-e 's#Group apache#Group abc#g' \
-e 's#AllowOverride none#AllowOverride All#' \
-e 's/#LoadModule\ rewrite_module/LoadModule\ rewrite_module/' \
/etc/apache2/httpd.conf && \
sed -i 's#PidFile "/run/.*#Pidfile "/var/run/apache2/httpd.pid"#g' /etc/apache2/conf.d/mpm.conf && \
# install projectsend
mkdir -p \
/usr/share/webapps/projectsend && \
PROJECTSEND_VER=$(curl -sX GET "https://api.github.com/repos/ignacionelson/ProjectSend/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]') && \
rm /var/www/localhost/htdocs/index.html && \
curl -o \
/tmp/projectsend.tar.gz -L \
"https://github.com/ignacionelson/ProjectSend/archive/${PROJECTSEND_VER}.tar.gz" && \
tar xf \
/tmp/projectsend.tar.gz -C \
/usr/share/webapps/projectsend --strip-components=1 && \
mv /usr/share/webapps/projectsend/upload /defaults/ && \
mv /usr/share/webapps/projectsend/img/custom /defaults/ && \
tmp/ProjectSend.tar.gz -L \
"https://codeload.github.com/ignacionelson/ProjectSend/tar.gz/r756" && \
tar -zxf \
/tmp/ProjectSend.tar.gz --strip-components=1 -C /var/www/localhost/htdocs/ && \
mv /var/www/localhost/htdocs/upload /defaults/ && \
mv /var/www/localhost/htdocs/img/custom /defaults/ && \
# cleanup
apk del --purge \
build-dependencies && \
rm -rf \
/tmp/*
# add local files
COPY root/ /
# ports and volumes
EXPOSE 80
VOLUME /config /data

View File

@ -1,83 +0,0 @@
<?php
/**
* ProjectSend personal configuration file
*
* This file contains the database connection information, the language
* definition, the maximum allowed filesize for uploads and the encoding
* that will be used on the sent e-mails (for new client, new user and
* new file).
*
* It be renamed to sys.config.php for ProjectSend to recognize
* it, and the database information must be completed before installing
* the software.
* The filesize value and the character encoding can be changed at anytime.
*
* When downloading a new ProjectSend version, this file will not be
* overwritten, as the version included by default is named
* sys.config.sample.php
*
* @package ProjectSend
*
*/
/**
* Enter your database connection information here
* If you have doubts about this values, consult your web hosting provider.
*/
/**
* Database driver to use with PDO.
* Possible options: mysql, mssql
*/
define('DB_DRIVER', 'mysql');
/** Database name */
define('DB_NAME', '');
/** Database host (in most cases it's localhost) */
define('DB_HOST', '');
/** Database username (must be assigned to the database) */
define('DB_USER', '');
/** Database password */
define('DB_PASSWORD', '');
/**
* Prefix for the tables. Set to something other than tbl_ for increased
* security onr in case you want more than 1 installations on the same database.
*/
define('TABLES_PREFIX', 'tbl_');
/*
* Global site language definition
*
* For this setting to work on the back-end (log-in, administration,
* and the installation pages, and the e-mails sent by the system), a file named
* x.mo (where x is the value that you define here) must exist on the folder
* /lang.
*
* The uploader language strings are loaded from the file x.mo (see above) that
* is located on the folder /includes/plupload/js/i18n/
*
* If you want to apply this setting to the client's file lists, you must
* have a file named x.mo (see above) on your selected template folder
* (eg: /templates/default/lang).
*
* English language files are included by default.
*
* This setting can be changed at anytime and the language will be applied
* immediately.
*
*/
define('SITE_LANG','en');
/**
* Define a maximum size (in mb.) that is allowed on each file to be uploaded.
*/
define('MAX_FILESIZE',2048);
/**
* Encoding to use on the e-mails sent to new clients, users, files, etc.
*/
define('EMAIL_ENCODING', 'utf-8');

View File

@ -1,30 +0,0 @@
server {
listen 80 default_server;
listen 443 ssl;
root /usr/share/webapps/projectsend;
index index.html index.htm index.php;
server_name _;
ssl_certificate /config/keys/cert.crt;
ssl_certificate_key /config/keys/cert.key;
client_max_body_size 0;
location / {
try_files $uri $uri/ /index.html /index.php?$args =404;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}

View File

@ -0,0 +1,55 @@
#!/usr/bin/with-contenv bash
# create our folders
mkdir -p \
/config/projectsend/images \
/data/projectsend \
/var/run/apache2
PREV_DIR=$(pwd)
cd /defaults/upload || exit
shopt -s globstar nullglob
shopt -s dotglob
for i in *
do
if [ ! -e "/data/projectsend/${i}" ] ; then
cp -R "${i}" "/data/projectsend/${i}"
chown abc:abc "/data/projectsend/${i}"
fi
done
cd /defaults/custom || exit
for i in *
do
if [ ! -e "/config/projectsend/images/${i}" ] ; then
cp -R "${i}" "/config/projectsend/images/${i}"
chown abc:abc "/config/projectsend/images/${i}"
fi
done
shopt -u globstar nullglob
shopt -u dotglob
cd "${PREV_DIR}" || exit
# create symlinks
[[ ! -L /var/www/localhost/htdocs/upload ]] && \
ln -sf /data/projectsend /var/www/localhost/htdocs/upload
[[ ! -L /var/www/localhost/htdocs/img/custom ]] && \
ln -sf /config/projectsend/images /var/www/localhost/htdocs/img/custom
[[ -f /var/www/localhost/htdocs/includes/sys.config.php ]] && \
rm /var/www/localhost/htdocs/includes/sys.config.php
[[ ! -L /var/www/localhost/htdocs/includes/sys.config.php ]] && \
ln -sf /config/projectsend/sys.config.php \
/var/www/localhost/htdocs/includes/sys.config.php
# permissions
chown abc:abc \
/data \
/data/projectsend
chown -R abc:abc \
/config \
/var/run/apache2 \
/var/www/localhost/htdocs

View File

@ -1,59 +0,0 @@
#!/usr/bin/with-contenv bash
# create our folders
mkdir -p \
/config/projectsend/images \
/data/projectsend
# copy config files
[[ ! -e /config/projectsend/sys.config.php ]] && \
cp /defaults/config.php /config/projectsend/sys.config.php
PREV_DIR=$(pwd)
cd /defaults/upload || exit
shopt -s globstar nullglob
shopt -s dotglob
for i in *
do
if [ ! -e "/data/projectsend/${i}" ] ; then
cp -R "${i}" "/data/projectsend/${i}"
chown abc:abc "/data/projectsend/${i}"
fi
done
cd /defaults/custom || exit
for i in *
do
if [ ! -e "/config/projectsend/images/${i}" ] ; then
cp -R "${i}" "/config/projectsend/images/${i}"
chown abc:abc "/config/projectsend/images/${i}"
fi
done
shopt -u globstar nullglob
shopt -u dotglob
cd "${PREV_DIR}" || exit
# create symlinks
[[ ! -L /usr/share/webapps/projectsend/upload ]] && \
ln -sf /data/projectsend /usr/share/webapps/projectsend/upload
[[ ! -L /usr/share/webapps/projectsend/img/custom ]] && \
ln -sf /config/projectsend/images /usr/share/webapps/projectsend/img/custom
[[ -f /usr/share/webapps/projectsend/includes/sys.config.php ]] && \
rm /usr/share/webapps/projectsend/includes/sys.config.php
[[ ! -L /usr/share/webapps/projectsend/includes/sys.config.php ]] && \
ln -sf /config/projectsend/sys.config.php \
/usr/share/webapps/projectsend/includes/sys.config.php
# permissions
chown abc:abc \
/data \
/data/projectsend
chown -R abc:abc \
/config \
/usr/share/webapps/projectsend/includes \
/usr/share/webapps/projectsend/upload \
/usr/share/webapps/projectsend/img/custom

View File

@ -0,0 +1,3 @@
#!/usr/bin/with-contenv bash
exec /usr/sbin/httpd -DNO_DETACH