Skip to content

Commit

Permalink
[#2] PR updates
Browse files Browse the repository at this point in the history
  • Loading branch information
yoanngesquiere committed Jun 28, 2015
1 parent ded0d7e commit e4cc28e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]
3 changes: 1 addition & 2 deletions doc/docker_installation.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
9 changes: 8 additions & 1 deletion docker/docker_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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}')
18 changes: 18 additions & 0 deletions docker/virtualhost
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost

DocumentRoot /var/www/html/web

<Directory /var/www/html/web >
AllowOverride All
Allow from All
Options -Indexes
DirectoryIndex app.php
</Directory>

ServerAdmin webmaster@localhost

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

0 comments on commit e4cc28e

Please sign in to comment.