Add Dockerfile. Ospos is now containerized. Pull image from

docker build -t me/ospos git://github.com/jekkos/opensourcepos.git

then run

    docker run -it me/opensourcepos

And head to port 80 to login to a new ospos install.
This commit is contained in:
jekkos
2016-01-12 16:45:18 +01:00
parent 2d0b20499e
commit a1ad99cc0d
2 changed files with 33 additions and 0 deletions

17
Dockerfile Normal file
View File

@@ -0,0 +1,17 @@
FROM jbfink/docker-lampstack
MAINTAINER jekkos
# Install dependencies
RUN apt-get install -y --no-install-recommends software-properties-common
RUN apt-get install -y python git
RUN apt-get update
# RUN add-apt-repository ppa:chris-lea/node.js
# Get latest Ospos source from Git
RUN git clone https://github.com/jekkos/opensourcepos.git /app
# RUN cd app && npm install
RUN ln -fs /app/* /var/www
ADD ./start_container.sh /start_container.sh
RUN chmod 755 /start_container.sh
EXPOSE 80 3306
CMD ["/bin/bash", "/start_container.sh"]

16
start_container.sh Normal file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
if [ ! -f /mysql-configured ]; then
/usr/bin/mysqld_safe &
sleep 10s
MYSQL_PASSWORD=`pwgen -c -n -1 12`
echo mysql root password: $MYSQL_PASSWORD
echo $MYSQL_PASSWORD > /mysql-root-pw.txt
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
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
sleep 10s
fi
supervisord -n