DockerFile to host botsArena

This commit is contained in:
Gnieark 2017-02-01 18:48:21 +01:00
parent 93d85e6700
commit b635d3db54
4 changed files with 22 additions and 13 deletions

View File

@ -1,12 +1,23 @@
#Docker image hosting botsarena
FROM tutum/lamp:latest 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 && \ RUN rm /var/www/html && \
mkdir /var/www/html mkdir /var/www/html
#Copy bots arena code
COPY html/ /var/www/html/ COPY html/ /var/www/html/
COPY src/ /var/www/src/ COPY src/ /var/www/src/
COPY lang /var/www/lang/ COPY lang /var/www/lang/
#Some config and mysql scripts
ADD dockerConfig/populate_mysql.sh /populate_mysql.sh ADD dockerConfig/populate_mysql.sh /populate_mysql.sh
RUN cp /var/www/src/config.php.empty /var/www/src/config.php && \ 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 chown -R www-data:www-data /var/www
EXPOSE 80 3306 EXPOSE 80 3306
ADD install.sql /install.sql ADD install.sql /install.sql
RUN rm /run.sh RUN rm /run.sh
ADD dockerConfig/run.sh /run.sh ADD dockerConfig/run.sh /run.sh
RUN chmod +x /run.sh RUN chmod +x /run.sh
CMD ["/run.sh"] CMD ["/run.sh"]

View File

@ -14,13 +14,15 @@ You are welcome, Make pull requests on branch dev. Im available on twitter [@gni
# install it # 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. 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 See dockerFile and associated scripts to understand what is needed.
* Apache/tomcat document root starts at ./html
* copy src/config.php.empty to src/config.php
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 '^/([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&params=$2&lang=$3 last; rewrite '^/p/([a-zA-Z]{1,})/(.*)-([a-z]{2})$' /index.php?page=$1&params=$2&lang=$3 last;

View File

@ -5,10 +5,7 @@ VOLUME_HOME="/var/lib/mysql"
sed -ri -e "s/^upload_max_filesize.*/upload_max_filesize = ${PHP_UPLOAD_MAX_FILESIZE}/" \ 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 -e "s/^post_max_size.*/post_max_size = ${PHP_POST_MAX_SIZE}/" /etc/php5/apache2/php.ini
if [[ ! -d $VOLUME_HOME/mysql ]]; then 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 mysql_install_db > /dev/null 2>&1
echo "=> Done!"
/populate_mysql.sh /populate_mysql.sh
else else
echo "=> Using an existing volume of MySQL" echo "=> Using an existing volume of MySQL"

@ -1 +1 @@
Subproject commit 1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a Subproject commit e94e6477e7977a59698c4a7c09b23bd49da50a0d