Updated to alpine linux
This commit is contained in:
142
Dockerfile
142
Dockerfile
@@ -1,86 +1,90 @@
|
||||
FROM ubuntu:14.04.4
|
||||
MAINTAINER Ric Harvey <ric@ngineered.co.uk>
|
||||
FROM alpine:3.4
|
||||
|
||||
# Surpress Upstart errors/warning
|
||||
RUN dpkg-divert --local --rename --add /sbin/initctl
|
||||
RUN ln -sf /bin/true /sbin/initctl
|
||||
MAINTAINER ngineered <support@ngineered.co.uk>
|
||||
|
||||
# Let the conatiner know that there is no tty
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV php_conf /etc/php5/php.ini
|
||||
ENV fpm_conf /etc/php5/php-fpm.conf
|
||||
|
||||
# Update base image
|
||||
# Add sources for latest nginx
|
||||
# Install software requirements
|
||||
RUN apt-get update && \
|
||||
apt-get install -y software-properties-common && \
|
||||
nginx=stable && \
|
||||
add-apt-repository ppa:nginx/$nginx && \
|
||||
apt-get update && \
|
||||
apt-get upgrade -y && \
|
||||
BUILD_PACKAGES="supervisor nginx php5-fpm git php5-mysql php-apc php5-curl php5-gd php5-intl php5-mcrypt php5-memcache php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-pgsql php5-mongo php5-ldap pwgen" && \
|
||||
apt-get -y install $BUILD_PACKAGES && \
|
||||
apt-get remove --purge -y software-properties-common && \
|
||||
apt-get autoremove -y && \
|
||||
apt-get clean && \
|
||||
apt-get autoclean && \
|
||||
echo -n > /var/lib/apt/extended_states && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
rm -rf /usr/share/man/?? && \
|
||||
rm -rf /usr/share/man/??_*
|
||||
RUN apk add --no-cache bash \
|
||||
openssh-client \
|
||||
wget \
|
||||
nginx \
|
||||
supervisor \
|
||||
curl \
|
||||
git \
|
||||
php5-fpm \
|
||||
php5-pdo \
|
||||
php5-pdo_mysql \
|
||||
php5-mysql \
|
||||
php5-mysqli \
|
||||
php5-mcrypt \
|
||||
php5-ctype \
|
||||
php5-zlib \
|
||||
php5-gd \
|
||||
php5-intl \
|
||||
php5-memcache \
|
||||
php5-sqlite3 \
|
||||
php5-pgsql \
|
||||
php5-xml \
|
||||
php5-xsl \
|
||||
php5-curl \
|
||||
php5-openssl \
|
||||
php5-iconv \
|
||||
php5-json \
|
||||
php5-phar \
|
||||
php5-dom && \
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer && \
|
||||
mkdir -p /etc/nginx && \
|
||||
mkdir -p /var/www/app && \
|
||||
mkdir -p /run/nginx && \
|
||||
mkdir -p /var/log/supervisor
|
||||
|
||||
# tweak nginx config
|
||||
RUN sed -i -e"s/worker_processes 1/worker_processes 5/" /etc/nginx/nginx.conf && \
|
||||
sed -i -e"s/keepalive_timeout\s*65/keepalive_timeout 2/" /etc/nginx/nginx.conf && \
|
||||
sed -i -e"s/keepalive_timeout 2/keepalive_timeout 2;\n\tclient_max_body_size 100m/" /etc/nginx/nginx.conf && \
|
||||
echo "daemon off;" >> /etc/nginx/nginx.conf
|
||||
ADD conf/supervisord.conf /etc/supervisord.conf
|
||||
|
||||
# tweak php-fpm config
|
||||
RUN sed -i -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php5/fpm/php.ini && \
|
||||
sed -i -e "s/upload_max_filesize\s*=\s*2M/upload_max_filesize = 100M/g" /etc/php5/fpm/php.ini && \
|
||||
sed -i -e "s/post_max_size\s*=\s*8M/post_max_size = 100M/g" /etc/php5/fpm/php.ini && \
|
||||
sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf && \
|
||||
sed -i -e "s/;catch_workers_output\s*=\s*yes/catch_workers_output = yes/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||
sed -i -e "s/pm.max_children = 5/pm.max_children = 9/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||
sed -i -e "s/pm.start_servers = 2/pm.start_servers = 3/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||
sed -i -e "s/pm.min_spare_servers = 1/pm.min_spare_servers = 2/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||
sed -i -e "s/pm.max_spare_servers = 3/pm.max_spare_servers = 4/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||
sed -i -e "s/pm.max_requests = 500/pm.max_requests = 200/g" /etc/php5/fpm/pool.d/www.conf
|
||||
|
||||
# fix ownership of sock file for php-fpm
|
||||
RUN sed -i -e "s/;listen.mode = 0660/listen.mode = 0750/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||
find /etc/php5/cli/conf.d/ -name "*.ini" -exec sed -i -re 's/^(\s*)#(.*)/\1;\2/g' {} \;
|
||||
|
||||
# mycrypt conf
|
||||
RUN php5enmod mcrypt
|
||||
# Copy our nginx config
|
||||
RUN rm -Rf /etc/nginx/nginx.conf
|
||||
ADD conf/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# nginx site conf
|
||||
RUN rm -Rf /etc/nginx/conf.d/* && \
|
||||
rm -Rf /etc/nginx/sites-available/default && \
|
||||
mkdir -p /etc/nginx/ssl/
|
||||
RUN mkdir -p /etc/nginx/sites-available/ && \
|
||||
mkdir -p /etc/nginx/sites-enabled/ && \
|
||||
mkdir -p /etc/nginx/ssl/ && \
|
||||
rm -Rf /var/www/* && \
|
||||
mkdir /var/www/html/
|
||||
ADD conf/nginx-site.conf /etc/nginx/sites-available/default.conf
|
||||
RUN ln -s /etc/nginx/sites-available/default.conf /etc/nginx/sites-enabled/default.conf
|
||||
|
||||
# Add git commands to allow container updating
|
||||
# tweak php-fpm config
|
||||
RUN sed -i -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" ${php_conf} && \
|
||||
sed -i -e "s/upload_max_filesize\s*=\s*2M/upload_max_filesize = 100M/g" ${php_conf} && \
|
||||
sed -i -e "s/post_max_size\s*=\s*8M/post_max_size = 100M/g" ${php_conf} && \
|
||||
sed -i -e "s/variables_order = \"GPCS\"/variables_order = \"EGPCS\"/g" ${php_conf} && \
|
||||
sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" ${fpm_conf} && \
|
||||
sed -i -e "s/;catch_workers_output\s*=\s*yes/catch_workers_output = yes/g" ${fpm_conf} && \
|
||||
sed -i -e "s/pm.max_children = 4/pm.max_children = 4/g" ${fpm_conf} && \
|
||||
sed -i -e "s/pm.start_servers = 2/pm.start_servers = 3/g" ${fpm_conf} && \
|
||||
sed -i -e "s/pm.min_spare_servers = 1/pm.min_spare_servers = 2/g" ${fpm_conf} && \
|
||||
sed -i -e "s/pm.max_spare_servers = 3/pm.max_spare_servers = 4/g" ${fpm_conf} && \
|
||||
sed -i -e "s/pm.max_requests = 500/pm.max_requests = 200/g" ${fpm_conf} && \
|
||||
sed -i -e "s/user = nobody/user = nginx/g" ${fpm_conf} && \
|
||||
sed -i -e "s/group = nobody/group = nginx/g" ${fpm_conf} && \
|
||||
sed -i -e "s/;listen.mode = 0660/listen.mode = 0666/g" ${fpm_conf} && \
|
||||
sed -i -e "s/;listen.owner = nobody/listen.owner = nginx/g" ${fpm_conf} && \
|
||||
sed -i -e "s/;listen.group = nobody/listen.group = nginx/g" ${fpm_conf} && \
|
||||
sed -i -e "s/listen = 127.0.0.1:9000/listen = \/var\/run\/php-fpm.sock/g" ${fpm_conf} &&\
|
||||
find /etc/php5/conf.d/ -name "*.ini" -exec sed -i -re 's/^(\s*)#(.*)/\1;\2/g' {} \;
|
||||
|
||||
# Add Scripts
|
||||
ADD scripts/start.sh /start.sh
|
||||
ADD scripts/pull /usr/bin/pull
|
||||
ADD scripts/push /usr/bin/push
|
||||
RUN chmod 755 /usr/bin/pull && chmod 755 /usr/bin/push
|
||||
|
||||
# Supervisor Config
|
||||
ADD conf/supervisord.conf /etc/supervisord.conf
|
||||
|
||||
# Start Supervisord
|
||||
ADD scripts/start.sh /start.sh
|
||||
RUN chmod 755 /start.sh
|
||||
|
||||
# Setup Volume
|
||||
VOLUME ["/usr/share/nginx/html"]
|
||||
# copy in code
|
||||
ADD src/ /var/www/html/
|
||||
|
||||
# add test PHP file
|
||||
ADD src/index.php /usr/share/nginx/html/index.php
|
||||
RUN chown -Rf www-data.www-data /usr/share/nginx/html/
|
||||
EXPOSE 443 80
|
||||
|
||||
# Expose Ports
|
||||
EXPOSE 443
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["/bin/bash", "/start.sh"]
|
||||
#CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]
|
||||
CMD ["/start.sh"]
|
||||
|
||||
Reference in New Issue
Block a user