Created
February 10, 2016 20:44
-
-
Save notserk/27b984927c3b0f7ef7e0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
FROM debian:jessie | |
MAINTAINER Wouter Admiraal <[email protected]> | |
ENV DEBIAN_FRONTEND noninteractive | |
RUN rm /bin/sh && ln -s /bin/bash /bin/sh | |
# Install packages. | |
RUN apt-get update | |
RUN apt-get install -y \ | |
vim \ | |
git \ | |
apache2 \ | |
php5-cli \ | |
php5-mysql \ | |
php5-gd \ | |
php5-curl \ | |
php5-xdebug \ | |
libapache2-mod-php5 \ | |
curl \ | |
openssh-server \ | |
phpmyadmin \ | |
wget \ | |
supervisor | |
RUN apt-get clean | |
# Install Composer. | |
RUN curl -sS https://getcomposer.org/installer | php | |
RUN mv composer.phar /usr/local/bin/composer | |
# Install Drush 7. | |
RUN composer global require drush/drush:7.* | |
RUN composer global update | |
# Unfortunately, adding the composer vendor dir to the PATH doesn't seem to work. So: | |
RUN ln -s /root/.composer/vendor/bin/drush /usr/local/bin/drush | |
# Setup PHP. | |
RUN sed -i 's/display_errors = Off/display_errors = On/' /etc/php5/apache2/php.ini | |
RUN sed -i 's/display_errors = Off/display_errors = On/' /etc/php5/cli/php.ini | |
# Setup Blackfire. | |
# Get the sources and install the Debian packages. | |
# We create our own start script. If the environment variables are set, we | |
# simply start Blackfire in the foreground. If not, we create a dummy daemon | |
# script that simply loops indefinitely. This is to trick Supervisor into | |
# thinking the program is running and avoid unnecessary error messages. | |
RUN wget -O - https://packagecloud.io/gpg.key | apt-key add - | |
RUN echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list | |
RUN apt-get update | |
RUN apt-get install -y blackfire-agent blackfire-php | |
RUN echo -e '#!/bin/bash\n\ | |
if [[ -z "$BLACKFIREIO_SERVER_ID" || -z "$BLACKFIREIO_SERVER_TOKEN" ]]; then\n\ | |
while true; do\n\ | |
sleep 1000\n\ | |
done\n\ | |
else\n\ | |
/usr/bin/blackfire-agent -server-id="$BLACKFIREIO_SERVER_ID" -server-token="$BLACKFIREIO_SERVER_TOKEN"\n\ | |
fi\n\ | |
' > /usr/local/bin/launch-blackfire | |
RUN chmod +x /usr/local/bin/launch-blackfire | |
RUN mkdir -p /var/run/blackfire | |
# Setup Apache. | |
# In order to run our Simpletest tests, we need to make Apache | |
# listen on the same port as the one we forwarded. Because we use | |
# 8080 by default, we set it up for that port. | |
RUN sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf | |
RUN sed -i 's/DocumentRoot \/var\/www\/html/DocumentRoot \/var\/www/' /etc/apache2/sites-available/000-default.conf | |
RUN echo "Listen 8080" >> /etc/apache2/ports.conf | |
RUN sed -i 's/VirtualHost \*:80/VirtualHost \*:\*/' /etc/apache2/sites-available/000-default.conf | |
RUN a2enmod rewrite | |
# Setup SSH. | |
RUN echo 'root:root' | chpasswd | |
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config | |
RUN mkdir /var/run/sshd && chmod 0755 /var/run/sshd | |
RUN mkdir -p /root/.ssh/ && touch /root/.ssh/authorized_keys | |
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd | |
# Setup Supervisor. | |
RUN echo -e '[program:apache2]\ncommand=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND"\nautorestart=true\n\n' >> /etc/supervisor/supervisord.conf | |
RUN echo -e '[program:mysql]\ncommand=/usr/bin/pidproxy /var/run/mysqld/mysqld.pid /usr/sbin/mysqld\nautorestart=true\n\n' >> /etc/supervisor/supervisord.conf | |
RUN echo -e '[program:sshd]\ncommand=/usr/sbin/sshd -D\n\n' >> /etc/supervisor/supervisord.conf | |
RUN echo -e '[program:blackfire]\ncommand=/usr/local/bin/launch-blackfire\n\n' >> /etc/supervisor/supervisord.conf | |
# Setup XDebug. | |
RUN echo "xdebug.max_nesting_level = 300" >> /etc/php5/apache2/conf.d/20-xdebug.ini | |
RUN echo "xdebug.max_nesting_level = 300" >> /etc/php5/cli/conf.d/20-xdebug.ini | |
# Install Drupal. | |
RUN rm -rf /var/www | |
RUN cd /var && \ | |
drush dl drupal-7.41 && \ | |
mv /var/drupal* /var/www | |
RUN mkdir -p /var/www/sites/default/files && \ | |
chmod a+w /var/www/sites/default -R && \ | |
mkdir /var/www/sites/all/modules/contrib -p && \ | |
mkdir /var/www/sites/all/modules/custom && \ | |
mkdir /var/www/sites/all/themes/contrib -p && \ | |
mkdir /var/www/sites/all/themes/custom && \ | |
chown -R www-data:www-data /var/www/ | |
RUN cd /var/www && \ | |
drush si -y minimal --db-url=mysql://root:[email protected]:32768/water --account-pass=admin && \ | |
drush dl admin_menu devel && \ | |
drush en -y admin_menu simpletest devel && \ | |
drush vset "admin_menu_tweak_modules" 1 && \ | |
drush vset "admin_theme" "seven" && \ | |
drush vset "node_admin_theme" 1 | |
EXPOSE 80 22 | |
CMD exec supervisord -n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment