Skip to content

Commit 732f7f5

Browse files
authored
Web: switched to alpine + nginx (#11)
1 parent 991d9c1 commit 732f7f5

File tree

9 files changed

+78
-6
lines changed

9 files changed

+78
-6
lines changed

docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ services:
5050
tmpfs:
5151
- /var/www/html/webmail/temp
5252
- /var/www/html/webmail/logs
53-
- /run/apache2
54-
- /run/lock/apache2
5553
- /tmp
5654
links:
5755
- db

web/Dockerfile

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:7.0-apache
1+
FROM php:7.1-fpm-alpine
22
MAINTAINER Jeffrey Boehm "[email protected]"
33

44
ENV MYSQL_HOST=db \
@@ -8,8 +8,24 @@ ENV MYSQL_HOST=db \
88
MANAGER_URL=http://www.grs-service.ch/pub/grs_mgr_v3-03_jessie_with_php7_setup.tgz \
99
WEBMAIL_URL=http://github.com/roundcube/roundcubemail/releases/download/1.2.0/roundcubemail-1.2.0.tar.gz
1010

11-
RUN apt-get update && apt-get install --no-install-recommends -y wget zlib1g-dev \
12-
&& docker-php-ext-install mysqli pdo_mysql zip
11+
RUN apk --no-cache add \
12+
nginx \
13+
supervisor \
14+
wget \
15+
ca-certificates \
16+
libmcrypt-dev \
17+
libpng-dev && \
18+
docker-php-ext-install -j4 \
19+
mcrypt \
20+
zip \
21+
mysqli \
22+
pdo_mysql && \
23+
ln -sf /dev/stdout /var/log/nginx/access.log && \
24+
ln -sf /dev/stderr /var/log/nginx/error.log && \
25+
ln -s /usr/local/bin/php /usr/bin/php && \
26+
rm -rf /var/lib/nginx/tmp && \
27+
ln -sf /tmp /var/lib/nginx/tmp && \
28+
update-ca-certificates
1329

1430
WORKDIR /var/www/html/manager
1531
RUN wget -q -O- $MANAGER_URL | tar -zx \
@@ -23,4 +39,6 @@ RUN wget -q -O- --no-check-certificate $WEBMAIL_URL | tar --strip 1 -zx \
2339
&& rm -rf installer/
2440

2541
WORKDIR /var/www/html
26-
COPY rootfs/ ./
42+
COPY rootfs/ /
43+
44+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]

web/rootfs/etc/nginx/nginx.conf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
user www-data;
2+
daemon off;
3+
worker_processes 1;
4+
5+
pid /tmp/nginx.pid;
6+
7+
events {
8+
worker_connections 1024;
9+
}
10+
11+
http {
12+
include mime.types;
13+
default_type application/octet-stream;
14+
sendfile on;
15+
keepalive_timeout 65;
16+
gzip on;
17+
18+
server {
19+
listen 80;
20+
root /var/www/html;
21+
index index.php index.html;
22+
23+
location / {
24+
try_files $uri $uri/ =404;
25+
}
26+
27+
location ~ \.php$ {
28+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
29+
fastcgi_pass 127.0.0.1:9000;
30+
fastcgi_index index.php;
31+
include fastcgi_params;
32+
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
33+
}
34+
}
35+
}

web/rootfs/etc/supervisord.conf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[supervisord]
2+
nodaemon=true
3+
logfile=/dev/stderr
4+
logfile_maxbytes=0
5+
pidfile=/tmp/supervisord.pid
6+
7+
[program:php-fpm]
8+
command=/usr/local/sbin/php-fpm
9+
redirect_stderr=true
10+
stdout_logfile=/dev/stderr
11+
stdout_logfile_maxbytes=0
12+
stderr_logfile=/dev/stderr
13+
stderr_logfile_maxbytes=0
14+
15+
[program:nginx]
16+
command=/usr/sbin/nginx
17+
redirect_stderr=true
18+
stdout_logfile=/dev/stderr
19+
stdout_logfile_maxbytes=0
20+
stderr_logfile=/dev/stderr
21+
stderr_logfile_maxbytes=0

0 commit comments

Comments
 (0)