|
| 1 | +FROM ubuntu:14.04 |
| 2 | + |
| 3 | +MAINTAINER Ian Lintner "[email protected]" |
| 4 | +ENV DEBIAN_FRONTEND noninteractive |
| 5 | + |
| 6 | +# Ensure UTF-8 |
| 7 | +RUN locale-gen en_US.UTF-8 |
| 8 | +ENV LANG en_US.UTF-8 |
| 9 | +ENV LC_ALL en_US.UTF-8 |
| 10 | + |
| 11 | +#ENV SMTP_HOST smtp.gmail.com |
| 12 | +#ENV SMTP_PORT 587 |
| 13 | +#ENV SMTP_FROMNAME My Name |
| 14 | +#ENV SMTP_USERNAME [email protected] |
| 15 | +#ENV SMTP_PASSWORD secret |
| 16 | + |
| 17 | +ENV TERM xterm |
| 18 | +ENV PHP_OPCACHE enabled |
| 19 | +# Update system |
| 20 | +RUN apt-get update && apt-get dist-upgrade -y |
| 21 | + |
| 22 | +# Prevent restarts when installing |
| 23 | +RUN echo '#!/bin/sh\nexit 101' > /usr/sbin/policy-rc.d && chmod +x /usr/sbin/policy-rc.d |
| 24 | + |
| 25 | +# Basic packages |
| 26 | +RUN apt-get -y install php5-fpm php5-mysql php-apc php5-imagick php5-imap php5-mcrypt php5-curl php5-cli php5-gd php5-pgsql php5-sqlite php5-common php-pear curl php5-json php5-redis php5-memcache |
| 27 | +RUN apt-get -y install nginx-extras git curl supervisor |
| 28 | +RUN apt-get -y install nano |
| 29 | +#RUN apt-get -y install msmtp msmtp-mta |
| 30 | + |
| 31 | +RUN php5enmod mcrypt |
| 32 | + |
| 33 | +RUN /usr/bin/curl -sS https://getcomposer.org/installer | /usr/bin/php |
| 34 | +RUN /bin/mv composer.phar /usr/local/bin/composer |
| 35 | +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
| 36 | + |
| 37 | +# Install Composer and Drush |
| 38 | +RUN /usr/local/bin/composer self-update |
| 39 | +RUN /usr/local/bin/composer global require drush/drush:6.* |
| 40 | +RUN ln -s /root/.composer/vendor/drush/drush/drush /usr/local/bin/drush |
| 41 | + |
| 42 | +# Prepare directory |
| 43 | +RUN mkdir /var/www |
| 44 | +RUN usermod -u 1000 www-data |
| 45 | +RUN usermod -a -G users www-data |
| 46 | +RUN chown -R www-data:www-data /var/www |
| 47 | + |
| 48 | +EXPOSE 80 |
| 49 | +EXPOSE 443 |
| 50 | +WORKDIR /var/www |
| 51 | +VOLUME ["/var/www/sites/default/files"] |
| 52 | +CMD ["/usr/bin/supervisord", "-n"] |
| 53 | + |
| 54 | +# Startup script |
| 55 | +# This startup script wll configure nginx |
| 56 | +ADD ./startup.sh /opt/startup.sh |
| 57 | +RUN chmod +x /opt/startup.sh |
| 58 | + |
| 59 | +#ADD ./mail.sh /opt/mail.sh |
| 60 | +#RUN chmod +x /opt/mail.sh |
| 61 | + |
| 62 | +ADD ./cron.sh /opt/cron.sh |
| 63 | +RUN chmod +x /opt/cron.sh |
| 64 | + |
| 65 | +# We want it empty |
| 66 | +#RUN touch /etc/msmtprc |
| 67 | +#RUN chgrp mail /etc/msmtprc |
| 68 | +#RUN chmod 660 /etc/msmtprc |
| 69 | +#RUN touch /var/log/supervisor/msmtp.log |
| 70 | +#RUN chgrp mail /var/log/supervisor/msmtp.log |
| 71 | +#RUN chmod 660 /var/log/supervisor/msmtp.log |
| 72 | +#RUN adduser www-data mail |
| 73 | + |
| 74 | +#RUN rm /usr/sbin/sendmail |
| 75 | +#RUN rm /usr/lib/sendmail |
| 76 | + |
| 77 | +#RUN ln -s /usr/bin/msmtp /usr/sbin/sendmail |
| 78 | +#RUN ln -s /usr/bin/msmtp /usr/bin/sendmail |
| 79 | +#RUN ln -s /usr/bin/msmtp /usr/lib/sendmail |
| 80 | + |
| 81 | +RUN mkdir -p /var/cache/nginx/microcache |
| 82 | + |
| 83 | +RUN mkdir -p /etc/nginx/ssl |
| 84 | +RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt |
| 85 | + |
| 86 | + |
| 87 | +### Add configuration files |
| 88 | +# Supervisor |
| 89 | +ADD ./config/supervisor/supervisord-nginx.conf /etc/supervisor/conf.d/supervisord-nginx.conf |
| 90 | + |
| 91 | +# PHP |
| 92 | +ADD ./config/php/www.conf /etc/php5/fpm/pool.d/www.conf |
| 93 | +ADD ./config/php/php.ini /etc/php5/fpm/php.ini |
| 94 | + |
| 95 | +# Nginx |
| 96 | +ADD ./config/nginx/blacklist.conf /etc/nginx/blacklist.conf |
| 97 | +ADD ./config/nginx/drupal.conf /etc/nginx/drupal.conf |
| 98 | +ADD ./config/nginx/drupal_upload_progress.conf /etc/nginx/drupal_upload_progress.conf |
| 99 | +ADD ./config/nginx/fastcgi.conf /etc/nginx/fastcgi.conf |
| 100 | +ADD ./config/nginx/fastcgi_drupal.conf /etc/nginx/fastcgi_drupal.conf |
| 101 | +ADD ./config/nginx/fastcgi_microcache_zone.conf /etc/nginx/fastcgi_microcache_zone.conf |
| 102 | +ADD ./config/nginx/fastcgi_no_args_drupal.conf /etc/nginx/fastcgi_no_args_drupal.conf |
| 103 | +ADD ./config/nginx/map_cache.conf /etc/nginx/map_cache.conf |
| 104 | +ADD ./config/nginx/microcache_fcgi.conf /etc/nginx/microcache_fcgi.conf |
| 105 | +ADD ./config/nginx/microcache_fcgi_auth.conf /etc/nginx/microcache_fcgi_auth.conf |
| 106 | +ADD ./config/nginx/mime.types /etc/nginx/mime.types |
| 107 | +ADD ./config/nginx/nginx.conf /etc/nginx/nginx.conf |
| 108 | +ADD ./config/nginx/upstream_phpcgi_unix.conf /etc/nginx/upstream_phpcgi_unix.conf |
| 109 | +ADD ./config/nginx/map_block_http_methods.conf /etc/nginx/map_block_http_methods.conf |
| 110 | +ADD ./config/nginx/map_https_fcgi.conf /etc/nginx/map_https_fcgi.conf |
| 111 | +ADD ./config/nginx/nginx_status_allowed_hosts.conf /etc/nginx/nginx_status_allowed_hosts.conf |
| 112 | +ADD ./config/nginx/cron_allowed_hosts.conf /etc/nginx/cron_allowed_hosts.conf |
| 113 | +ADD ./config/nginx/php_fpm_status_allowed_hosts.conf /etc/nginx/php_fpm_status_allowed_hosts.conf |
| 114 | +ADD ./config/nginx/default /etc/nginx/sites-enabled/default |
| 115 | + |
0 commit comments