update(): alpine 3.7 and flarum 0.1.0-beta.7.1

pull/26/head
Hardware 2018-01-14 11:31:43 +01:00
parent 0beb7667da
commit 0ffd6913f8
No known key found for this signature in database
GPG Key ID: EC6DF6F90263EDEA
10 changed files with 194 additions and 89 deletions

View File

@ -1,13 +1,37 @@
FROM wonderfall/nginx-php:7.1 FROM alpine:3.7
LABEL description "Next-generation forum software that makes online discussion fun" \ LABEL description "Next-generation forum software that makes online discussion fun" \
maintainer="Hardware <hardware@mondedie.fr>, Magicalex <magicalex@mondedie.fr>" maintainer="Hardware <hardware@mondedie.fr>, Magicalex <magicalex@mondedie.fr>"
ARG VERSION=v0.1.0-beta.7 ARG VERSION=v0.1.0-beta.7
ENV GID=991 UID=991 UPLOAD_MAX_SIZE=50M MEMORY_LIMIT=128M ENV GID=991 UID=991 UPLOAD_MAX_SIZE=50M
RUN apk add -U curl \ RUN echo "@community https://nl.alpinelinux.org/alpine/v3.7/community" >> /etc/apk/repositories \
&& apk add -U \
nginx \
s6 \
su-exec \
curl \
php7@community \
php7-fileinfo@community \
php7-phar@community \
php7-fpm@community \
php7-curl@community \
php7-mbstring@community \
php7-openssl@community \
php7-json@community \
php7-pdo@community \
php7-pdo_mysql@community \
php7-mysqlnd@community \
php7-zlib@community \
php7-gd@community \
php7-dom@community \
php7-ctype@community \
php7-session@community \
php7-opcache@community \
php7-xmlwriter@community \
php7-tokenizer@community \
&& cd /tmp \ && cd /tmp \
&& curl -s http://getcomposer.org/installer | php \ && curl -s http://getcomposer.org/installer | php \
&& mv /tmp/composer.phar /usr/bin/composer \ && mv /tmp/composer.phar /usr/bin/composer \
@ -19,7 +43,7 @@ RUN apk add -U curl \
&& rm -rf /flarum/.composer /var/cache/apk/* && rm -rf /flarum/.composer /var/cache/apk/*
COPY rootfs / COPY rootfs /
RUN chmod +x /usr/local/bin/* /etc/s6.d/*/* /etc/s6.d/.s6-svscan/* RUN chmod +x /usr/local/bin/* /services/*/run /services/.s6-svscan/*
VOLUME /flarum/app/assets /flarum/app/extensions VOLUME /flarum/app/assets /flarum/app/extensions
EXPOSE 8888 EXPOSE 8888
CMD ["run.sh"] CMD ["run.sh"]

View File

@ -41,7 +41,6 @@ Flarum is the next-generation forum software that makes online discussion fun. I
| **DB_PASS** | MariaDB database password | **required** | none | **DB_PASS** | MariaDB database password | **required** | none
| **DB_PREF** | Flarum tables prefix | *optional* | none | **DB_PREF** | Flarum tables prefix | *optional* | none
| **UPLOAD_MAX_SIZE** | The maximum size of an uploaded file | *optional* | 50M | **UPLOAD_MAX_SIZE** | The maximum size of an uploaded file | *optional* | 50M
| **MEMORY_LIMIT** | maximum amount of memory used by php | *optional* | 128M
## Installation ## Installation

137
rootfs/etc/nginx/nginx.conf Normal file
View File

@ -0,0 +1,137 @@
worker_processes auto;
pid /tmp/nginx.pid;
daemon off;
events {
worker_connections 1024;
use epoll;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log off;
error_log /tmp/ngx_error.log error;
sendfile on;
keepalive_timeout 15;
keepalive_disable msie6;
keepalive_requests 100;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
fastcgi_temp_path /tmp/fastcgi 1 2;
client_body_temp_path /tmp/client_body 1 2;
proxy_temp_path /tmp/proxy 1 2;
uwsgi_temp_path /tmp/uwsgi 1 2;
scgi_temp_path /tmp/scgi 1 2;
gzip on;
gzip_comp_level 5;
gzip_min_length 512;
gzip_buffers 4 8k;
gzip_proxied any;
gzip_vary on;
gzip_disable "msie6";
gzip_types
text/css
text/javascript
text/xml
text/plain
text/x-component
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
application/vnd.ms-fontobject
font/truetype
font/opentype
image/svg+xml;
server {
listen 8888;
root /flarum/app;
index index.php;
charset utf-8;
client_max_body_size <UPLOAD_MAX_SIZE>;
fastcgi_buffers 64 4K;
error_page 403 /403.html;
error_page 404 /404.html;
error_page 500 /500.html;
error_page 503 /503.html;
location = /403.html { root /flarum/app/vendor/flarum/core/error; }
location = /404.html { root /flarum/app/vendor/flarum/core/error; }
location = /500.html { root /flarum/app/vendor/flarum/core/error; }
location = /503.html { root /flarum/app/vendor/flarum/core/error; }
location / { try_files $uri $uri/ /index.php?$query_string; }
location /api { try_files $uri $uri/ /api.php?$query_string; }
location /admin { try_files $uri $uri/ /admin.php?$query_string; }
# Access path list
# --------------------------------------
location ~ /\. {
deny all;
return 404;
}
location ~* ^/(Procfile|storage|Vagrantfile|config\.php|LICENSE|vendor|flarum|scripts) {
deny all;
return 404;
}
location ~* composer(.*?) {
deny all;
return 404;
}
location ~* (.*?)\.md {
deny all;
return 404;
}
# Assets cache control
# --------------------------------------
location ~* \.(?:html|xml|json)$ {
expires -1;
}
location ~* \.(?:css|js)$ {
expires 7d;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location ~* \.(?:gif|jpe?g|png|ico|otf|eot|svg|ttf|woff|woff2)$ {
expires 30d;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# PHP Backend
# --------------------------------------
location ~* \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTP_PROXY "";
fastcgi_index index.php;
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
fastcgi_param REMOTE_ADDR $http_x_real_ip;
}
}
}

View File

@ -0,0 +1,15 @@
[global]
daemonize = no
error_log = /tmp/php_error.log
[www]
listen = /tmp/php-fpm.sock
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /
php_admin_value[expose_php] = Off
php_admin_value[post_max_size] = <UPLOAD_MAX_SIZE>
php_admin_value[upload_max_filesize] = <UPLOAD_MAX_SIZE>

View File

@ -1,80 +0,0 @@
server {
listen 8888;
root /flarum/app;
index index.php;
charset utf-8;
fastcgi_buffers 64 4K;
error_page 403 /403.html;
error_page 404 /404.html;
error_page 500 /500.html;
error_page 503 /503.html;
location = /403.html { root /flarum/app/vendor/flarum/core/error; }
location = /404.html { root /flarum/app/vendor/flarum/core/error; }
location = /500.html { root /flarum/app/vendor/flarum/core/error; }
location = /503.html { root /flarum/app/vendor/flarum/core/error; }
location / { try_files $uri $uri/ /index.php?$query_string; }
location /api { try_files $uri $uri/ /api.php?$query_string; }
location /admin { try_files $uri $uri/ /admin.php?$query_string; }
# Access path list
# --------------------------------------
location ~ /\. {
deny all;
return 404;
}
location ~* ^/(Procfile|storage|Vagrantfile|config\.php|LICENSE|vendor|flarum|scripts) {
deny all;
return 404;
}
location ~* composer(.*?) {
deny all;
return 404;
}
location ~* (.*?)\.md {
deny all;
return 404;
}
# Assets cache control
# --------------------------------------
location ~* \.(?:html|xml|json)$ {
expires -1;
}
location ~* \.(?:css|js)$ {
expires 7d;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location ~* \.(?:gif|jpe?g|png|ico|otf|eot|svg|ttf|woff|woff2)$ {
expires 30d;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# PHP Backend
# --------------------------------------
location ~* \.php$ {
try_files $uri =404;
include /nginx/conf/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTP_PROXY "";
fastcgi_index index.php;
fastcgi_pass unix:/php/run/php-fpm.sock;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
fastcgi_param REMOTE_ADDR $http_x_real_ip;
}
}

View File

@ -0,0 +1,2 @@
#!/bin/sh
exit 0

View File

@ -0,0 +1,2 @@
#!/bin/sh
exec nginx

2
rootfs/services/php/run Normal file
View File

@ -0,0 +1,2 @@
#!/bin/sh
exec php-fpm7

View File

@ -23,14 +23,18 @@ if [ -z "$FORUM_URL" ]; then
exit 1 exit 1
fi fi
sed -i -e "s/<UPLOAD_MAX_SIZE>/$UPLOAD_MAX_SIZE/g" /nginx/conf/nginx.conf /php/etc/php-fpm.conf \ sed -i "s/<UPLOAD_MAX_SIZE>/$UPLOAD_MAX_SIZE/g" /etc/nginx/nginx.conf /etc/php7/php-fpm.conf
-e "s/<MEMORY_LIMIT>/$MEMORY_LIMIT/g" /php/etc/php-fpm.conf
# Set permissions # Set permissions
chown -R $UID:$GID /flarum /nginx /php /var/log /tmp /etc/s6.d chown -R $UID:$GID /flarum /services /var/log /var/lib/nginx
cd /flarum/app cd /flarum/app
# Disable custom errors pages if debug mode is enabled
if [ "$DEBUG" = true ]; then
sed -i '/error_page/ s/^/#/' /etc/nginx/nginx.conf
fi
# Custom HTTP errors pages # Custom HTTP errors pages
if [ -d 'assets/errors' ]; then if [ -d 'assets/errors' ]; then
echo "[INFO] Found custom errors pages" echo "[INFO] Found custom errors pages"
@ -92,4 +96,4 @@ fi
chown -R $UID:$GID /flarum chown -R $UID:$GID /flarum
# RUN ! # RUN !
exec su-exec $UID:$GID /bin/s6-svscan /etc/s6.d exec su-exec $UID:$GID /bin/s6-svscan /services