Actualizado usando imagen php:5.6-apache

This commit is contained in:
Sergio C. Orozco Torres 2017-09-22 01:08:06 -05:00
parent 4272b78484
commit b3b328f80c
5 changed files with 82 additions and 41 deletions

View File

@ -2,51 +2,40 @@
# https://www.rosariosis.org/
# Best Dockerfile practices: http://crosbymichael.com/dockerfile-best-practices.html
FROM ubuntu
FROM php:5.6-apache
MAINTAINER François Jacquet <francoisjacquet@users.noreply.github.com>
ENV DEBIAN_FRONTEND noninteractive
# Release info.
RUN cat /etc/lsb-release
# Upgrade packages.
# Add universe depot.
RUN sed 's/InRelease$/InRelease universe/' -i /etc/apt/sources.list
# Change date to force an upgrade:
RUN apt-get update # 2016-06-29
RUN apt-get upgrade -y
# Install git, Apache2 + PHP + PostgreSQL webserver, sendmail, wkhtmltopdf & others utilities.
RUN apt-get install git postgresql sendmail wkhtmltopdf supervisor apache2 \
libapache2-mod-php php-pgsql php-curl php-xmlrpc \
openssl telnet nmap -y --force-yes
RUN apt-get install postgresql-client wkhtmltopdf libpq-dev libpng-dev libxml2-dev sendmail -y;
RUN docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \
docker-php-ext-install -j$(nproc) gd mbstring xml pgsql gettext xmlrpc
RUN mkdir /usr/src/rosariosis && curl -L https://github.com/francoisjacquet/rosariosis/tarball/v3.5 | tar xz --strip-components=1 -C /usr/src/rosariosis
RUN git clone https://github.com/francoisjacquet/rosariosis.git /usr/src/rosariosis
WORKDIR /usr/src/rosariosis
RUN rm -rf /var/www/html && mkdir -p /var/www && \
ln -s /usr/src/rosariosis/ /var/www/html && chmod 777 /var/www/html &&\
chown -R www-data:www-data /usr/src/rosariosis
# Uncomment to checkout a tagged release:
# RUN git checkout 2.9.3
# Links rosariosis directory to Apache document root.
RUN rm -rf /var/www/html && mkdir -p /var/www && ln -s /usr/src/rosariosis/ /var/www/html && chmod 777 /var/www/html
# Copy our init script (creates rosariosis PostgreSQL DB & import rosariosis.sql file).
COPY bin/init /init
# Copy our start Apache2 script.
COPY bin/start-apache2 /start-apache2
# Copy our custom supervisord.conf file.
COPY conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Copy our custom RosarioSIS configuration file.
COPY conf/config.inc.php /usr/src/rosariosis/config.inc.php
COPY conf/.htaccess /usr/src/rosariosis/.htaccess
COPY bin/init /init
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
EXPOSE 80
ENTRYPOINT [ "/init" ]
ENTRYPOINT ["/init"]
CMD ["apache2-foreground"]

View File

@ -1,10 +1,29 @@
#!/bin/bash
DB_EXISTS=`psql -U postgres -h $ROSARIODB_PORT_5432_TCP_ADDR -p $ROSARIODB_PORT_5432_TCP_PORT -l | grep rosariosis | wc -l`
if [ "$DB_EXISTS" -eq "0" ]; then
psql -U postgres -h $ROSARIODB_PORT_5432_TCP_ADDR -p $ROSARIODB_PORT_5432_TCP_PORT -c "CREATE DATABASE rosariosis WITH ENCODING 'UTF8' TEMPLATE template1"
psql -U postgres -h $ROSARIODB_PORT_5432_TCP_ADDR -p $ROSARIODB_PORT_5432_TCP_PORT rosariosis < rosariosis.sql
echo "Configuring locale"
if [ "$ROSARIOSIS_LANG" == "en_US" ]; then
echo "Found "$ROSARIOSIS_LANG
else
echo "Installing "$ROSARIOSIS_LANG
apt-get install locales
echo $ROSARIOSIS_LANG'.UTF-8 UTF-8' > /etc/locale.gen
locale-gen
fi
/usr/bin/supervisord
echo "Configuring database"
RETRIES=5
until psql -c "select 1" > /dev/null 2>&1 || [ $RETRIES -eq 0 ]; do
echo "Waiting for postgres server, $((RETRIES--)) remaining attempts..."
sleep 1
done
DB_EXISTS=`psql -l | grep rosariosis | wc -l`
echo 'Database '$DB_EXISTS
if [ "$DB_EXISTS" -eq "1" ]; then
psql -f /usr/src/rosariosis/rosariosis.sql
else
echo "Database does not exists"
fi

1
conf/.htaccess Normal file
View File

@ -0,0 +1 @@
php_flag display_errors off

View File

@ -14,19 +14,20 @@
*/
// Database server hostname: use localhost if on same server.
$DatabaseServer = getenv( 'ROSARIODB_PORT_5432_TCP_ADDR' );
$DatabaseServer = getenv( 'PGHOST' );
// Database username.
$DatabaseUsername = 'postgres';
$DatabaseUsername = getenv( 'PGUSER' );
// Database password.
//$DatabasePassword = 'password_here';
$DatabasePassword = getenv( 'PGPASSWORD' );;
// Database name.
$DatabaseName = 'rosariosis';
$DatabaseName = getenv( 'PGDATABASE' );;
// Database port: default is 5432.
$DatabasePort = getenv( 'ROSARIODB_PORT_5432_TCP_PORT' );
$DatabasePort = getenv( 'PGPORT' );
/**
@ -52,7 +53,7 @@ $pg_dumpPath = '/usr/bin/pg_dump';
* @example /usr/local/bin/wkhtmltopdf
* @example C:/Progra~1/wkhtmltopdf/bin/wkhtmltopdf.exe
*/
$wkhtmltopdfPath = '/usr/local/bin/wkhtmltopdf';
$wkhtmltopdfPath = '/usr/bin/wkhtmltopdf';
/**
@ -62,7 +63,7 @@ $wkhtmltopdfPath = '/usr/local/bin/wkhtmltopdf';
* Change after rollover
* Should match the database to be able to login
*/
$DefaultSyear = '2016';
$DefaultSyear = getenv( 'ROSARIOSIS_YEAR' );
/**
@ -85,4 +86,4 @@ $RosarioNotifyAddress = getenv( 'ROSARIOSIS_ADMIN_EMAIL' );
*
* @example array( 'en_US.utf8', 'fr_FR.utf8', 'es_ES.utf8' );
*/
$RosarioLocales = array( 'en_US.utf8' );
$RosarioLocales = array( getenv( 'ROSARIOSIS_LANG' ).'.utf8' );

31
docker-compose.yml Normal file
View File

@ -0,0 +1,31 @@
version: '3.1'
services:
db:
image: sameersbn/postgresql:9.5
environment:
POSTGRES_PASSWORD: example
DB_USER: rosario
DB_PASS: rosariopwd
DB_NAME: rosariosis
web:
build: .
ports:
- "80:80"
depends_on:
- db
environment:
PGHOST: db
PGUSER: rosario
PGPASSWORD: rosariopwd
PGDATABASE: rosariosis
PGPORT: 5432
ROSARIOSIS_YEAR: 2017
ROSARIOSIS_LANG: 'es_ES'
adminer:
image: adminer
ports:
- 8081:8080