Tidy up dockerfile
This commit is contained in:
108
Dockerfile
108
Dockerfile
@@ -8,84 +8,72 @@ RUN ln -sf /bin/true /sbin/initctl
|
|||||||
# Let the conatiner know that there is no tty
|
# Let the conatiner know that there is no tty
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
RUN apt-get update
|
# Update base image
|
||||||
RUN apt-get install -y wget
|
|
||||||
|
|
||||||
# Add sources for latest nginx
|
# Add sources for latest nginx
|
||||||
RUN echo deb http://nginx.org/packages/mainline/debian/ jessie nginx >> /etc/apt/sources.list
|
|
||||||
RUN echo deb-src http://nginx.org/packages/mainline/debian/ jessie nginx >> /etc/apt/sources.list
|
|
||||||
|
|
||||||
RUN wget http://nginx.org/keys/nginx_signing.key
|
|
||||||
RUN apt-key add nginx_signing.key
|
|
||||||
|
|
||||||
# Add PHP packages from dotdeb
|
# Add PHP packages from dotdeb
|
||||||
RUN echo deb http://packages.dotdeb.org jessie all >> /etc/apt/sources.list
|
# Install software requirements
|
||||||
RUN echo deb-src http://packages.dotdeb.org jessie all >> /etc/apt/sources.list
|
RUN apt-get update && \
|
||||||
|
apt-get upgrade -y && \
|
||||||
RUN wget http://www.dotdeb.org/dotdeb.gpg
|
apt-get install -y wget && \
|
||||||
RUN apt-key add dotdeb.gpg
|
echo deb http://nginx.org/packages/mainline/debian/ jessie nginx >> /etc/apt/sources.list && \
|
||||||
|
echo deb-src http://nginx.org/packages/mainline/debian/ jessie nginx >> /etc/apt/sources.list && \
|
||||||
# Update System
|
wget http://nginx.org/keys/nginx_signing.key && \
|
||||||
RUN apt-get update
|
apt-key add nginx_signing.key && \
|
||||||
RUN apt-get -y upgrade
|
echo deb http://packages.dotdeb.org jessie all >> /etc/apt/sources.list && \
|
||||||
|
echo deb-src http://packages.dotdeb.org jessie all >> /etc/apt/sources.list && \
|
||||||
# Basic Requirements
|
wget http://www.dotdeb.org/dotdeb.gpg && \
|
||||||
RUN apt-get -y install nginx php5-fpm php5-mysql php-apc pwgen python-setuptools curl git unzip vim
|
apt-key add dotdeb.gpg && \
|
||||||
|
BUILD_PACKAGES="supervisor nginx php5-fpm git php5-mysql php5-mysql php-apc php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-pspell php5-recode php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-pgsql php5-mongo pwgen" && \
|
||||||
# Install Extra PHP Modules
|
apt-get -y install $BUILD_PACKAGES && \
|
||||||
RUN apt-get -y install php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-pspell php5-recode php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-pgsql php5-mongo
|
apt-get remove --purge -y wget && \
|
||||||
|
apt-get clean && \
|
||||||
|
echo -n > /var/lib/apt/extended_states && \
|
||||||
|
apt-get autoclean && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
rm -rf /usr/share/man/?? && \
|
||||||
|
rm -rf /usr/share/man/??_*
|
||||||
|
|
||||||
# tweak nginx config
|
# tweak nginx config
|
||||||
RUN sed -i -e"s/worker_processes 1/worker_processes 5/" /etc/nginx/nginx.conf # gets over written by start.sh to match cpu's on container
|
RUN sed -i -e"s/worker_processes 1/worker_processes 5/" /etc/nginx/nginx.conf && \
|
||||||
RUN sed -i -e"s/keepalive_timeout\s*65/keepalive_timeout 2/" /etc/nginx/nginx.conf
|
sed -i -e"s/keepalive_timeout\s*65/keepalive_timeout 2/" /etc/nginx/nginx.conf && \
|
||||||
RUN sed -i -e"s/keepalive_timeout 2/keepalive_timeout 2;\n\tclient_max_body_size 100m/" /etc/nginx/nginx.conf
|
sed -i -e"s/keepalive_timeout 2/keepalive_timeout 2;\n\tclient_max_body_size 100m/" /etc/nginx/nginx.conf && \
|
||||||
RUN sed -i "s/.*conf\.d\/\*\.conf;.*/&\n include \/etc\/nginx\/sites-enabled\/\*;/" /etc/nginx/nginx.conf
|
sed -i "s/.*conf\.d\/\*\.conf;.*/&\n include \/etc\/nginx\/sites-enabled\/\*;/" /etc/nginx/nginx.conf && \
|
||||||
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
|
echo "daemon off;" >> /etc/nginx/nginx.conf
|
||||||
|
|
||||||
# tweak php-fpm config
|
# tweak php-fpm config
|
||||||
RUN sed -i -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php5/fpm/php.ini
|
RUN sed -i -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php5/fpm/php.ini && \
|
||||||
RUN sed -i -e "s/upload_max_filesize\s*=\s*2M/upload_max_filesize = 100M/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 && \
|
||||||
RUN sed -i -e "s/post_max_size\s*=\s*8M/post_max_size = 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 && \
|
||||||
RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf
|
sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf && \
|
||||||
RUN 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/;catch_workers_output\s*=\s*yes/catch_workers_output = yes/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||||
RUN 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.max_children = 5/pm.max_children = 9/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||||
RUN 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.start_servers = 2/pm.start_servers = 3/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||||
RUN 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.min_spare_servers = 1/pm.min_spare_servers = 2/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||||
RUN 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_spare_servers = 3/pm.max_spare_servers = 4/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||||
RUN sed -i -e "s/pm.max_requests = 500/pm.max_requests = 200/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 as our version of nginx runs as nginx
|
# fix ownership of sock file for php-fpm as our version of nginx runs as nginx
|
||||||
RUN sed -i -e "s/user = www-data/user = nginx/g" /etc/php5/fpm/pool.d/www.conf
|
RUN sed -i -e "s/user = www-data/user = nginx/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||||
RUN sed -i -e "s/group = www-data/group = nginx/g" /etc/php5/fpm/pool.d/www.conf
|
sed -i -e "s/group = www-data/group = nginx/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||||
RUN sed -i -e "s/listen.owner = www-data/listen.owner = nginx/g" /etc/php5/fpm/pool.d/www.conf
|
sed -i -e "s/listen.owner = www-data/listen.owner = nginx/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||||
RUN sed -i -e "s/listen.group = www-data/listen.group = nginx/g" /etc/php5/fpm/pool.d/www.conf
|
sed -i -e "s/listen.group = www-data/listen.group = nginx/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||||
RUN sed -i -e "s/;listen.mode = 0660/listen.mode = 0750/g" /etc/php5/fpm/pool.d/www.conf
|
sed -i -e "s/;listen.mode = 0660/listen.mode = 0750/g" /etc/php5/fpm/pool.d/www.conf && \
|
||||||
RUN find /etc/php5/cli/conf.d/ -name "*.ini" -exec sed -i -re 's/^(\s*)#(.*)/\1;\2/g' {} \;
|
find /etc/php5/cli/conf.d/ -name "*.ini" -exec sed -i -re 's/^(\s*)#(.*)/\1;\2/g' {} \;
|
||||||
|
|
||||||
# nginx site conf
|
# nginx site conf
|
||||||
RUN rm -Rf /etc/nginx/conf.d/*
|
RUN rm -Rf /etc/nginx/conf.d/* && \
|
||||||
RUN mkdir -p /etc/nginx/sites-available/
|
mkdir -p /etc/nginx/sites-available/ && \
|
||||||
RUN mkdir -p /etc/nginx/sites-enabled/
|
mkdir -p /etc/nginx/sites-enabled/ && \
|
||||||
RUN mkdir -p /etc/nginx/ssl/
|
mkdir -p /etc/nginx/ssl/
|
||||||
ADD ./nginx-site.conf /etc/nginx/sites-available/default.conf
|
ADD ./nginx-site.conf /etc/nginx/sites-available/default.conf
|
||||||
RUN ln -s /etc/nginx/sites-available/default.conf /etc/nginx/sites-enabled/default.conf
|
RUN ln -s /etc/nginx/sites-available/default.conf /etc/nginx/sites-enabled/default.conf
|
||||||
|
|
||||||
# Tidy up files and shrink image size
|
|
||||||
RUN apt-get autoremove
|
|
||||||
RUN apt-get clean
|
|
||||||
RUN rm -rf /var/lib/apt/lists/*
|
|
||||||
RUN rm -rf /usr/share/man/??
|
|
||||||
RUN rm -rf /usr/share/man/??_*
|
|
||||||
|
|
||||||
# Add git commands to allow container updating
|
# Add git commands to allow container updating
|
||||||
ADD ./pull /usr/bin/pull
|
ADD ./pull /usr/bin/pull
|
||||||
ADD ./push /usr/bin/push
|
ADD ./push /usr/bin/push
|
||||||
RUN chmod 755 /usr/bin/pull
|
RUN chmod 755 /usr/bin/pull && chmod 755 /usr/bin/push
|
||||||
RUN chmod 755 /usr/bin/push
|
|
||||||
|
|
||||||
# Supervisor Config
|
# Supervisor Config
|
||||||
RUN /usr/bin/easy_install supervisor
|
|
||||||
RUN /usr/bin/easy_install supervisor-stdout
|
|
||||||
ADD ./supervisord.conf /etc/supervisord.conf
|
ADD ./supervisord.conf /etc/supervisord.conf
|
||||||
|
|
||||||
# Start Supervisord
|
# Start Supervisord
|
||||||
|
|||||||
Reference in New Issue
Block a user