forked from LukysekBay/container
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
130 lines (116 loc) · 4.25 KB
/
Dockerfile
File metadata and controls
130 lines (116 loc) · 4.25 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
FROM nginx:mainline-alpine
MAINTAINER ngineered <support@ngineered.co.uk>
ENV php_conf /etc/php7/php.ini
ENV fpm_conf /etc/php7/php-fpm.d/www.conf
#ENV composer_hash aa96f26c2b67226a324c27919f1eb05f21c248b987e6195cad9690d5c1ff713d53020a02ac8c217dbf90a7eacc9d141d
RUN sed -i -e "s/v3.4/edge/" /etc/apk/repositories && apk update && \
apk add --no-cache bash \
openssh-client \
wget \
nginx \
supervisor \
curl \
git \
php7-fpm \
php7-pdo \
php7-pdo_mysql \
php7-mysqlnd \
php7-mysqli \
php7-mcrypt \
php7-mbstring \
php7-ctype \
php7-zlib \
php7-gd \
php7-exif \
php7-intl \
php7-sqlite3 \
php7-pdo_pgsql \
php7-pgsql \
php7-xml \
php7-xsl \
php7-curl \
php7-openssl \
php7-iconv \
php7-json \
php7-phar \
php7-soap \
php7-dom \
php7-zip \
php7-session \
python \
python-dev \
py2-pip \
augeas-dev \
openssl-dev \
ca-certificates \
dialog \
gcc \
musl-dev \
linux-headers \
libffi-dev &&\
mkdir -p /etc/nginx && \
mkdir -p /var/www/app && \
mkdir -p /run/nginx && \
mkdir -p /var/log/supervisor && \
# php7 -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
# php7 -r "if (hash_file('SHA384', 'composer-setup.php') === '${composer_hash}') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
# php7 composer-setup.php --install-dir=/usr/bin --filename=composer && \
# php7 -r "unlink('composer-setup.php');" && \
pip install -U pip && \
pip install -U certbot && \
mkdir -p /etc/letsencrypt/webrootauth && \
apk del gcc musl-dev linux-headers libffi-dev augeas-dev python-dev
RUN rm -rf /var/cache/apk/* /tmp/*
ADD conf/supervisord.conf /etc/supervisord.conf
# Copy our nginx config
RUN rm -Rf /etc/nginx/nginx.conf
ADD conf/nginx.conf /etc/nginx/nginx.conf
# nginx site conf
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
#ADD conf/nginx-site-ssl.conf /etc/nginx/sites-available/default-ssl.conf
RUN ln -s /etc/nginx/sites-available/default.conf /etc/nginx/sites-enabled/default.conf
# tweak php-fpm config
RUN sed -i \
-e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" \
-e "s/upload_max_filesize\s*=\s*2M/upload_max_filesize = 100M/g" \
-e "s/post_max_size\s*=\s*8M/post_max_size = 100M/g" \
-e "s/variables_order = \"GPCS\"/variables_order = \"EGPCS\"/g" \
${php_conf} && \
sed -i \
-e "s/;daemonize\s*=\s*yes/daemonize = no/g" \
-e "s/;catch_workers_output\s*=\s*yes/catch_workers_output = yes/g" \
-e "s/pm.max_children = 4/pm.max_children = 4/g" \
-e "s/pm.start_servers = 2/pm.start_servers = 3/g" \
-e "s/pm.min_spare_servers = 1/pm.min_spare_servers = 2/g" \
-e "s/pm.max_spare_servers = 3/pm.max_spare_servers = 4/g" \
-e "s/pm.max_requests = 500/pm.max_requests = 200/g" \
-e "s/user = nobody/user = nginx/g" \
-e "s/group = nobody/group = nginx/g" \
-e "s/;listen.mode = 0660/listen.mode = 0666/g" \
-e "s/;listen.owner = nobody/listen.owner = nginx/g" \
-e "s/;listen.group = nobody/listen.group = nginx/g" \
-e "s/listen = 127.0.0.1:9000/listen = \/var\/run\/php-fpm.sock/g" \
-e "s/^;clear_env = no$/clear_env = no/" \
${fpm_conf} && \
ln -s /etc/php7/php.ini /etc/php7/conf.d/php.ini && \
find /etc/php7/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
#ADD scripts/letsencrypt-setup /usr/bin/letsencrypt-setup
#ADD scripts/letsencrypt-renew /usr/bin/letsencrypt-renew
#RUN chmod 755 /usr/bin/pull && chmod 755 /usr/bin/push && chmod 755 /usr/bin/letsencrypt-setup && chmod 755 /usr/bin/letsencrypt-renew && chmod 755 /start.sh
RUN chmod 755 /start.sh
# copy in code
ADD src/ /var/www/html/
ADD errors/ /var/www/errors
VOLUME /var/www/html
EXPOSE 80
#CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]
CMD ["/start.sh"]