forked from nixelsolutions/rancher-wordpress-ha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (49 loc) · 2.19 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM ubuntu:14.04
MAINTAINER Manel Martinez <[email protected]>
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y python-software-properties software-properties-common
RUN add-apt-repository -y ppa:ondrej/php && \
apt-get update && \
apt-get install -y --force-yes php7.0-fpm php7.0-mysql php7.0-mcrypt php7.0-opcache
RUN add-apt-repository -y ppa:gluster/glusterfs-3.5 && \
apt-get update && \
apt-get install -y nginx supervisor glusterfs-client curl haproxy pwgen unzip mysql-client dnsutils
ENV WORDPRESS_VERSION 4.2.2
ENV WORDPRESS_NAME wordpress
ENV GLUSTER_VOL ranchervol
ENV GLUSTER_VOL_PATH /var/www
ENV HTTP_PORT 80
ENV HTTP_DOCUMENTROOT **ChangeMe**
ENV PHP_SESSION_PATH ${GLUSTER_VOL_PATH}/phpsessions
ENV DEBUG 0
ENV DB_USER root
ENV DB_PASSWORD **ChangeMe**
ENV WP_DB_NAME **ChangeMe**
ENV DB_HOST db
ENV GLUSTER_HOST storage
RUN mkdir -p /var/log/supervisor ${GLUSTER_VOL_PATH}
WORKDIR ${GLUSTER_VOL_PATH}
RUN mkdir -p /usr/local/bin
ADD ./bin /usr/local/bin
RUN chmod +x /usr/local/bin/*.sh
ADD ./etc/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
ADD ./etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg
ADD ./etc/nginx/sites-enabled/wordpress /etc/nginx/sites-enabled/wordpress
RUN mkdir -p /run/php
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
chmod +x wp-cli.phar && \
sudo mv wp-cli.phar /usr/local/bin/wp
# nginx config
RUN 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
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN rm -f /etc/nginx/sites-enabled/default
# php-fpm config
RUN sed -i -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php/7.0/fpm/php.ini
RUN sed -i -e "s/upload_max_filesize\s*=\s*2M/upload_max_filesize = 100M/g" /etc/php/7.0/fpm/php.ini
RUN sed -i -e "s/post_max_size\s*=\s*8M/post_max_size = 100M/g" /etc/php/7.0/fpm/php.ini
RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php/7.0/fpm/php-fpm.conf
# HAProxy
RUN perl -p -i -e "s/ENABLED=0/ENABLED=1/g" /etc/default/haproxy
CMD ["/usr/local/bin/run.sh"]