Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SuiteCRM 7.8.3 version #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions 7.8.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM php:5.6-apache

ENV DOWNLOAD_URL http://downloads.sourceforge.net/project/suitecrm/SuiteCRM-7.8.3.zip?r=&ts=1458855387&use_mirror=iweb
ENV DOWNLOAD_FILE suitecrm-7.8.3.zip
ENV EXTRACT_FOLDER SuiteCRM-7.8.3
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 -o $DOWNLOAD_FILE -L "${DOWNLOAD_URL}" && \
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 /etc/cron.d/crons.conf
RUN crontab /etc/cron.d/crons.conf

EXPOSE 80
ENTRYPOINT ["/usr/local/bin/init.sh"]
17 changes: 17 additions & 0 deletions 7.8.3/config_override.php.pyt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
if(null !== $$installer_defaults) {
$$installer_defaults['setup_db_host_name'] = '$db_host_name';
$$installer_defaults['setup_db_database_name'] = '$database_name';
$$installer_defaults['setup_db_admin_user_name'] = '$db_user_name';
$$installer_defaults['setup_db_admin_password'] = '$db_password';
$$installer_defaults['db_type'] = '$db_type';
}

if(null !== $$sugar_config) {
$$sugar_config['dbconfig']['db_port'] = '$db_tcp_port';
$$sugar_config['dbconfig']['db_manager'] = '$db_manager';
$$sugar_config['dbconfig']['db_host_name'] = '$db_host_name';
$$sugar_config['dbconfig']['db_user_name'] = '$db_user_name';
$$sugar_config['dbconfig']['db_password'] = '$db_password';
}
?>
1 change: 1 addition & 0 deletions 7.8.3/crons.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* * * * * www-data /usr/local/bin/php -f /var/www/html/cron.php >> /var/log/cron.log 2>&1
48 changes: 48 additions & 0 deletions 7.8.3/envtemplate.py
Original file line number Diff line number Diff line change
@@ -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 <inputfile> -o <outputfile>'
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print 'test.py -i <inputfile> -o <outputfile>'
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:])
32 changes: 32 additions & 0 deletions 7.8.3/init.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions 7.8.3/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
upload_max_filesize = 25M
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
suitecrm:
build: 7.5.3
build: 7.8.3
ports:
- "8080:80"
links:
Expand Down