From e4cc28e3a534902e19af750ad640f2f5b6f0a723 Mon Sep 17 00:00:00 2001 From: Yoann Gesquiere Date: Sun, 28 Jun 2015 16:45:12 +0200 Subject: [PATCH] [#2] PR updates --- Dockerfile | 10 +++++++--- doc/docker_installation.md | 3 +-- docker/docker_setup.sh | 9 ++++++++- docker/virtualhost | 18 ++++++++++++++++++ 4 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 docker/virtualhost diff --git a/Dockerfile b/Dockerfile index e3cc1cf..20f3b49 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,12 +10,12 @@ RUN apt-get update && \ apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer -ENV COMPOSER_HOME=/usr/bin/composer +ENV COMPOSER_HOME /usr/bin/composer # MySQL service RUN mkdir /etc/service/mysql && \ echo "#!/bin/bash" > /etc/service/mysql/run && \ - echo "mysqld_safe" >> /etc/service/mysql/run && \ + echo "mysqld_safe --skip-syslog" >> /etc/service/mysql/run && \ chmod +x /etc/service/mysql/run # Apache service @@ -32,6 +32,10 @@ RUN mkdir -p /etc/my_init.d ADD docker/docker_setup.sh /etc/my_init.d/docker_setup.sh RUN chmod +x /etc/my_init.d/docker_setup.sh -RUN sed -i -e 's?/var/www/html?/var/www/html/web?' /etc/apache2/sites-enabled/000-default.conf +ADD docker/virtualhost /etc/apache2/sites-enabled/000-default.conf + +RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf +RUN echo "LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so" > /etc/apache2/mods-available/rewrite.load +RUN a2enmod rewrite VOLUME ["/var/www/html"] diff --git a/doc/docker_installation.md b/doc/docker_installation.md index d2d54ff..47883fc 100644 --- a/doc/docker_installation.md +++ b/doc/docker_installation.md @@ -1,6 +1,6 @@ # Docker installation -To run Airlines in Docker, you need to install Docker and check that the version is greater than 1.2. +To run Airlines in Docker, you need to install Docker and check that the version is greater or equal to 1.0.1. To verify your version, run: ```sh @@ -15,7 +15,6 @@ Once you are done with this, you can build your image and run your container: ```sh sudo docker build -t airlines . sudo docker run airlines -sudo docker inspect $(sudo docker ps | grep airlines | awk '{ print $(NF) }') | grep IPAddress ``` It will output the IP address of your container. Now, you just have to open a browser, paste the address diff --git a/docker/docker_setup.sh b/docker/docker_setup.sh index 7e4bd21..0aa8838 100644 --- a/docker/docker_setup.sh +++ b/docker/docker_setup.sh @@ -3,7 +3,7 @@ set -e echo "Docker setup is running" -/usr/bin/mysqld_safe & +/usr/bin/mysqld_safe --skip-syslog & until [ -x /var/run/mysqld/mysqld.sock ] do @@ -14,6 +14,7 @@ cd /var/www/html/ # Clear cache avoiding permission problems in the new container rm -rf app/cache +rm app/config/parameters.yml # Classic symfony install composer install @@ -27,3 +28,9 @@ chmod -R 777 app/cache chmod -R 777 app/logs echo "Docker setup has ended" + +echo "--------------" +echo "server address" +http="http://" +echo "--------------" +echo $http$(ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}') \ No newline at end of file diff --git a/docker/virtualhost b/docker/virtualhost new file mode 100644 index 0000000..74574d4 --- /dev/null +++ b/docker/virtualhost @@ -0,0 +1,18 @@ + + ServerName localhost + ServerAlias localhost + + DocumentRoot /var/www/html/web + + + AllowOverride All + Allow from All + Options -Indexes + DirectoryIndex app.php + + + ServerAdmin webmaster@localhost + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + \ No newline at end of file