From b635d3db542d8faa042ee8e7bc6267b100efc108 Mon Sep 17 00:00:00 2001 From: Gnieark Date: Wed, 1 Feb 2017 18:48:21 +0100 Subject: [PATCH] DockerFile to host botsArena --- Dockerfile | 18 ++++++++++++++---- README.md | 12 +++++++----- dockerConfig/run.sh | 3 --- src/PHPMailer | 2 +- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6267ba9..b9494b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,23 @@ +#Docker image hosting botsarena + FROM tutum/lamp:latest -#delete symbolic linc + +MAINTAINER Gnieark https://blog-du-grouik.tinad.fr + + +RUN apt-get update && \ + apt-get install -q -y php5-curl + +#delete symbolic linc RUN rm /var/www/html && \ mkdir /var/www/html - + +#Copy bots arena code COPY html/ /var/www/html/ COPY src/ /var/www/src/ COPY lang /var/www/lang/ +#Some config and mysql scripts ADD dockerConfig/populate_mysql.sh /populate_mysql.sh RUN cp /var/www/src/config.php.empty /var/www/src/config.php && \ @@ -14,11 +25,10 @@ RUN cp /var/www/src/config.php.empty /var/www/src/config.php && \ chown -R www-data:www-data /var/www EXPOSE 80 3306 + ADD install.sql /install.sql RUN rm /run.sh ADD dockerConfig/run.sh /run.sh RUN chmod +x /run.sh - - CMD ["/run.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 7e01c7f..d6c08f6 100755 --- a/README.md +++ b/README.md @@ -14,13 +14,15 @@ You are welcome, Make pull requests on branch dev. Im available on twitter [@gni # install it I'd better like you to help me to improve [bot's Arena](https://botsarena.tinad.fr/), and you to make your own bots to play challenges. It would be more funny having lot of bots in one arena rather than lot of arenas. -* Mysql structure is in the .sql -* Apache/tomcat document root starts at ./html -* copy src/config.php.empty to src/config.php +See dockerFile and associated scripts to understand what is needed. -Apache RewriteRules are given on the file html/.htaccess +To test an image of bots arena with docker: -For nginx in server directive: + make + docker build . + docker run --name hey -p 127.0.0.1:8080:80 DockerImageId + +For nginx Rewrite rules in server directive are: rewrite '^/([a-zA-Z]{1,})/doc-([a-z]{2})$' /index.php?doc=$1&lang=$2 last; rewrite '^/p/([a-zA-Z]{1,})/(.*)-([a-z]{2})$' /index.php?page=$1¶ms=$2&lang=$3 last; diff --git a/dockerConfig/run.sh b/dockerConfig/run.sh index dcae71f..3d2f46d 100644 --- a/dockerConfig/run.sh +++ b/dockerConfig/run.sh @@ -5,10 +5,7 @@ VOLUME_HOME="/var/lib/mysql" sed -ri -e "s/^upload_max_filesize.*/upload_max_filesize = ${PHP_UPLOAD_MAX_FILESIZE}/" \ -e "s/^post_max_size.*/post_max_size = ${PHP_POST_MAX_SIZE}/" /etc/php5/apache2/php.ini if [[ ! -d $VOLUME_HOME/mysql ]]; then - echo "=> An empty or uninitialized MySQL volume is detected in $VOLUME_HOME" - echo "=> Installing MySQL ..." mysql_install_db > /dev/null 2>&1 - echo "=> Done!" /populate_mysql.sh else echo "=> Using an existing volume of MySQL" diff --git a/src/PHPMailer b/src/PHPMailer index 1d85f9e..e94e647 160000 --- a/src/PHPMailer +++ b/src/PHPMailer @@ -1 +1 @@ -Subproject commit 1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a +Subproject commit e94e6477e7977a59698c4a7c09b23bd49da50a0d