From 0e00f49336dabf00446e9f49272102bcf2b9ed07 Mon Sep 17 00:00:00 2001 From: Dariusz Szablowski Date: Tue, 13 Sep 2016 16:49:31 +0200 Subject: [PATCH] update to 7.7.4 --- 7.7.4/Dockerfile | 39 ++++++++++++++++++++++++++++ 7.7.4/config_override.php.pyt | 17 +++++++++++++ 7.7.4/crons.conf | 1 + 7.7.4/envtemplate.py | 48 +++++++++++++++++++++++++++++++++++ 7.7.4/init.sh | 32 +++++++++++++++++++++++ 7.7.4/php.ini | 1 + docker-compose.yml | 2 +- 7 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 7.7.4/Dockerfile create mode 100644 7.7.4/config_override.php.pyt create mode 100644 7.7.4/crons.conf create mode 100644 7.7.4/envtemplate.py create mode 100644 7.7.4/init.sh create mode 100644 7.7.4/php.ini diff --git a/7.7.4/Dockerfile b/7.7.4/Dockerfile new file mode 100644 index 0000000..5dee8ae --- /dev/null +++ b/7.7.4/Dockerfile @@ -0,0 +1,39 @@ +FROM php:5.6-apache + +ENV DOWNLOAD_URL https://sourceforge.net/projects/suitecrm/files/SuiteCRM-7.7.4.zip +ENV DOWNLOAD_FILE SuiteCRM-7.7.4.zip +ENV EXTRACT_FOLDER SuiteCRM-7.7.4 +ENV WWW_FOLDER /var/www/html +ENV WWW_USER www-data +ENV WWW_GROUP www-data + +RUN apt-get update && apt-get upgrade -y && \ + apt-get install -y libcurl4-gnutls-dev libpng-dev libssl-dev libc-client2007e-dev libkrb5-dev unzip cron re2c python tree && \ + docker-php-ext-configure imap --with-imap-ssl --with-kerberos && \ + docker-php-ext-install mysql curl gd zip mbstring imap && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /tmp + +RUN curl -L "${DOWNLOAD_URL}" > $DOWNLOAD_FILE && \ + unzip $DOWNLOAD_FILE && \ + rm $DOWNLOAD_FILE && \ + rm -rf ${WWW_FOLDER}/* && \ + cp -R ${EXTRACT_FOLDER}/* ${WWW_FOLDER}/ && \ + chown -R ${WWW_USER}:${WWW_GROUP} ${WWW_FOLDER}/* && \ + chown -R ${WWW_USER}:${WWW_GROUP} ${WWW_FOLDER} + +ADD php.ini /usr/local/etc/php/php.ini +ADD config_override.php.pyt /usr/local/src/config_override.php.pyt +ADD envtemplate.py /usr/local/bin/envtemplate.py +ADD init.sh /usr/local/bin/init.sh + +RUN chmod u+x /usr/local/bin/init.sh +RUN chmod u+x /usr/local/bin/envtemplate.py + +ADD crons.conf /root/crons.conf +RUN crontab /root/crons.conf + +EXPOSE 80 +ENTRYPOINT ["/usr/local/bin/init.sh"] + diff --git a/7.7.4/config_override.php.pyt b/7.7.4/config_override.php.pyt new file mode 100644 index 0000000..02b5f42 --- /dev/null +++ b/7.7.4/config_override.php.pyt @@ -0,0 +1,17 @@ + diff --git a/7.7.4/crons.conf b/7.7.4/crons.conf new file mode 100644 index 0000000..bd9299b --- /dev/null +++ b/7.7.4/crons.conf @@ -0,0 +1 @@ +* * * * * cd /var/www/html; php -f cron.php > /dev/null 2>&1 diff --git a/7.7.4/envtemplate.py b/7.7.4/envtemplate.py new file mode 100644 index 0000000..a84eaa9 --- /dev/null +++ b/7.7.4/envtemplate.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +import os, sys, getopt +from string import Template + +def main(argv): + inputfile = '' + outputfile = '' + try: + opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="]) + except getopt.GetoptError: + print 'test.py -i -o ' + sys.exit(2) + for opt, arg in opts: + if opt == '-h': + print 'test.py -i -o ' + sys.exit() + elif opt in ("-i", "--ifile"): + inputfile = arg + elif opt in ("-o", "--ofile"): + outputfile = arg + + # Read all environment variables in and populate a case-insensitive + # dictionary for replacement + values = dict() + for k in os.environ: + v = os.environ.get(k) + values[k] = v + values[k.lower()] = v + + + + # Read the template + ifile = open(inputfile) + templatestr = open(inputfile).read() + ifile.close() + + out = Template(templatestr).substitute(values) + + print "Writing output to {}".format(outputfile) + print "===============================" + print out + + ofile = open(outputfile, "w") + ofile.write(out) + ofile.close() + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/7.7.4/init.sh b/7.7.4/init.sh new file mode 100644 index 0000000..69c4f0c --- /dev/null +++ b/7.7.4/init.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +set -e + +if [ -z "$DB_HOST_NAME" ]; then + export DB_HOST_NAME=$DB_PORT_3306_TCP_ADDR +fi + +if [ -z "$DB_TCP_PORT" ]; then + export DB_TCP_PORT=$DB_PORT_3306_TCP_PORT +fi + +if [ -z "$DB_USER_NAME" ]; then + export DB_USER_NAME=$DB_ENV_MYSQL_USER +fi + +if [ -z "$DB_PASSWORD" ]; then + export DB_PASSWORD=$DB_ENV_MYSQL_PASSWORD +fi + +if [ -z "$DATABASE_NAME" ]; then + export DATABASE_NAME=$DB_ENV_MYSQL_DATABASE +fi + +/usr/local/bin/envtemplate.py -i /usr/local/src/config_override.php.pyt -o /var/www/html/config_override.php +/usr/sbin/cron + +# Remove Apache PID lock file so apache can start next time +rm -f /run/apache2/apache2.pid + +# Start Apache +apachectl -DFOREGROUND diff --git a/7.7.4/php.ini b/7.7.4/php.ini new file mode 100644 index 0000000..2df0c4d --- /dev/null +++ b/7.7.4/php.ini @@ -0,0 +1 @@ +upload_max_filesize = 25M \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index f3ae86c..6543fe5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,5 @@ suitecrm: - build: 7.1.6 + build: 7.7.4 ports: - "8080:80" links: