diff --git a/Dockerfile b/Dockerfile index e1eb87352..030d029d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,10 @@ FROM ubuntu:trusty MAINTAINER jekkos RUN apt-get update RUN apt-get -y upgrade -RUN DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-client mysql-server apache2 libapache2-mod-php5 pwgen python-setuptools vim-tiny php5-mysql +RUN DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-client mysql-server apache2 libapache2-mod-php5 pwgen python-setuptools vim-tiny php5-mysql php5-gd RUN easy_install supervisor -ADD ./foreground.sh /etc/apache2/foreground.sh -ADD ./supervisord.conf /etc/supervisord.conf +ADD ./docker/foreground.sh /etc/apache2/foreground.sh +ADD ./docker/supervisord.conf /etc/supervisord.conf RUN chmod 755 /etc/apache2/foreground.sh # Install dependencies RUN apt-get install -y --no-install-recommends software-properties-common @@ -15,11 +15,11 @@ RUN apt-get install -y python git # Get latest Ospos source from Git RUN git clone https://github.com/jekkos/opensourcepos.git /app -RUN cd app && git checkout develop/2.4 +# RUN cd app && git checkout develop/2.4 # RUN cd app && npm install RUN ln -fs /app/* /var/www/html -ADD ./start_container.sh /start_container.sh +ADD ./docker/start_container.sh /start_container.sh RUN chmod 755 /start_container.sh EXPOSE 80 3306 CMD ["/bin/bash", "/start_container.sh"] diff --git a/foreground.sh b/docker/foreground.sh similarity index 100% rename from foreground.sh rename to docker/foreground.sh diff --git a/start_container.sh b/docker/start_container.sh similarity index 64% rename from start_container.sh rename to docker/start_container.sh index c509668fa..449edec29 100644 --- a/start_container.sh +++ b/docker/start_container.sh @@ -8,10 +8,9 @@ if [ ! -f /mysql-configured ]; then [ -f /var/www/html/index.html ] && rm /var/www/html/index.html mysqladmin -u root password $MYSQL_PASSWORD cp /app/application/config/database.php.tmpl /app/application/config/database.php -# sed -i "s/\(password...=.\).*/\1'${MYSQL_PASSWORD}';/g" /app/application/config/database.php - sed -i "s/\(password..=..\).*/\1'${MYSQL_PASSWORD}',/g" /app/application/config/database.php - sed -i "s/\(database..=..\).*/\1'ospos',/g" /app/application/config/database.php - sed -i "s/\(username..=..\).*/\1'root',/g" /app/application/config/database.php + sed -i -e "s/\(user.*\?=.\).*\(.\)$/\1'root'\2/g" /app/application/config/database.php + sed -i -e "s/\(password.*\?=.\).*\(.\)$/\1'${MYSQL_PASSWORD}'\2/g" /app/application/config/database.php + sed -i -e "s/\(database.*\?=.\).*\(.\)$/\1'ospos'\2/g" /app/application/config/database.php mysql -e "CREATE DATABASE IF NOT EXISTS ospos; use ospos; source /app/database/tables.sql; source /app/database/constraints.sql;" -uroot -p${MYSQL_PASSWORD} touch /mysql-configured killall mysqld diff --git a/supervisor.conf b/docker/supervisor.conf similarity index 100% rename from supervisor.conf rename to docker/supervisor.conf diff --git a/supervisord.conf b/docker/supervisord.conf similarity index 100% rename from supervisord.conf rename to docker/supervisord.conf