-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from exflickr/docker
Docker support
- Loading branch information
Showing
8 changed files
with
156 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
* text=auto | ||
*.sh text eol=lf | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
FROM ubuntu:14.04 | ||
|
||
# Install the packages we need | ||
RUN export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get update && \ | ||
apt-get upgrade -y && \ | ||
apt-get install -y php5-cli git php5-mcrypt php5-curl apache2 libapache2-mod-php5 mysql-server php5-mysql memcached php5-memcache php5-mcrypt && \ | ||
apt-get autoremove && \ | ||
apt-get clean && apt-get autoclean | ||
|
||
# Turn on the mcrypt php module and the rewrite\ssl apache modules | ||
RUN php5enmod mcrypt && \ | ||
a2enmod rewrite && \ | ||
a2enmod ssl | ||
|
||
# TODO: Proper ssl certs via letsencrypt or something | ||
|
||
# Configure our path for where we'll serve source-code from | ||
WORKDIR /mnt/flamework | ||
COPY tests/docker/001-flamework.conf /etc/apache2/sites-available/ | ||
RUN a2ensite 001-flamework | ||
RUN a2dissite 000-default | ||
|
||
RUN rm -rf /var/www/html | ||
RUN ln -fs /mnt/flamework/www /var/www/html | ||
|
||
# TODO: PHPUnit via Pear is dead. Also, conditionally install only when running tests? | ||
#RUN apt-get install -y php-pear | ||
#RUN pear channel-discover pear.phpunit.de | ||
#RUN pear install phpunit/PHP_CodeCoverage | ||
|
||
# TODO: Only install when running tests? | ||
#RUN apt-get install -y make | ||
#RUN pecl install xdebug | ||
#RUN echo "zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so" > /etc/php5/conf.d/xdebug.ini | ||
|
||
# Allow mounting of source code from external to the container | ||
VOLUME ["/mnt/flamework"] | ||
|
||
# Optional persistence of the mysql data | ||
VOLUME ["/var/lib/mysql"] | ||
|
||
# Listen on the HTTP and HTTPS ports | ||
EXPOSE 80 | ||
EXPOSE 443 | ||
|
||
# When the container is run, this script will start mysql and apache, | ||
# and put a sample config in place if necessary | ||
ENTRYPOINT [ "/bin/bash", "tests/docker/entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<VirtualHost *:80> | ||
DocumentRoot /var/www/html | ||
|
||
<Directory /var/www/html> | ||
Options +Indexes +FollowSymLinks -MultiViews | ||
AllowOverride All | ||
Order allow,deny | ||
allow from all | ||
require all granted | ||
</Directory> | ||
|
||
ErrorLog ${APACHE_LOG_DIR}/error.log | ||
|
||
# Possible values include: debug, info, notice, warn, error, crit, | ||
# alert, emerg. | ||
LogLevel warn | ||
|
||
CustomLog ${APACHE_LOG_DIR}/access.log combined | ||
|
||
RewriteEngine on | ||
#RewriteLog ${APACHE_LOG_DIR}/rewrite.log | ||
#RewriteLogLevel 3 | ||
|
||
DirectoryIndex index.php | ||
</VirtualHost> | ||
|
||
<VirtualHost *:443> | ||
DocumentRoot /var/www/html | ||
|
||
<Directory /var/www/html> | ||
Options +Indexes -MultiViews | ||
AllowOverride All | ||
Order allow,deny | ||
allow from all | ||
require all granted | ||
</Directory> | ||
|
||
ErrorLog ${APACHE_LOG_DIR}/error.log | ||
LogLevel warn | ||
CustomLog ${APACHE_LOG_DIR}/access.log combined | ||
|
||
RewriteEngine on | ||
|
||
DirectoryIndex index.php | ||
|
||
SSLEngine on | ||
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem | ||
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key | ||
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# We want to halt on errors and also print out what we're doing | ||
set -eux | ||
|
||
# Start memcached | ||
/etc/init.d/memcached start | ||
|
||
# Start mysql and create the database if it doesn't exist | ||
/etc/init.d/mysql start | ||
mysql -e 'CREATE DATABASE IF NOT EXISTS flamework;' | ||
mysql -Dflamework < schema/db_main.schema | ||
|
||
# Put the example configuration in place if it doesn't exist | ||
cd /mnt/flamework | ||
if [[ ! -e www/include/config.php ]]; then | ||
cp www/include/config.php.example www/include/config.php | ||
perl -i -pe "s/'pass'\t=> 'root',/'pass'\t=> '',/g" www/include/config.php | ||
fi | ||
|
||
# Templates need to be writable by the web server | ||
chown www-data www/templates_c | ||
chmod 755 www/templates_c | ||
|
||
# Start apache in the foreground so that the container stays running | ||
exec apachectl -D FOREGROUND |