Skip to content

Commit

Permalink
Web: switched to alpine + nginx (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeboehm authored Oct 13, 2016
1 parent 991d9c1 commit 732f7f5
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 6 deletions.
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ services:
tmpfs:
- /var/www/html/webmail/temp
- /var/www/html/webmail/logs
- /run/apache2
- /run/lock/apache2
- /tmp
links:
- db
Expand Down
26 changes: 22 additions & 4 deletions web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.0-apache
FROM php:7.1-fpm-alpine
MAINTAINER Jeffrey Boehm "[email protected]"

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

RUN apt-get update && apt-get install --no-install-recommends -y wget zlib1g-dev \
&& docker-php-ext-install mysqli pdo_mysql zip
RUN apk --no-cache add \
nginx \
supervisor \
wget \
ca-certificates \
libmcrypt-dev \
libpng-dev && \
docker-php-ext-install -j4 \
mcrypt \
zip \
mysqli \
pdo_mysql && \
ln -sf /dev/stdout /var/log/nginx/access.log && \
ln -sf /dev/stderr /var/log/nginx/error.log && \
ln -s /usr/local/bin/php /usr/bin/php && \
rm -rf /var/lib/nginx/tmp && \
ln -sf /tmp /var/lib/nginx/tmp && \
update-ca-certificates

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

WORKDIR /var/www/html
COPY rootfs/ ./
COPY rootfs/ /

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
35 changes: 35 additions & 0 deletions web/rootfs/etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
user www-data;
daemon off;
worker_processes 1;

pid /tmp/nginx.pid;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;

server {
listen 80;
root /var/www/html;
index index.php index.html;

location / {
try_files $uri $uri/ =404;
}

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
}
}
21 changes: 21 additions & 0 deletions web/rootfs/etc/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[supervisord]
nodaemon=true
logfile=/dev/stderr
logfile_maxbytes=0
pidfile=/tmp/supervisord.pid

[program:php-fpm]
command=/usr/local/sbin/php-fpm
redirect_stderr=true
stdout_logfile=/dev/stderr
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:nginx]
command=/usr/sbin/nginx
redirect_stderr=true
stdout_logfile=/dev/stderr
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
File renamed without changes.
File renamed without changes.
File renamed without changes

0 comments on commit 732f7f5

Please sign in to comment.