Initial commit - WIP

pull/3/head
Hardware 2016-07-14 10:12:58 +02:00
commit 6170a65bec
No known key found for this signature in database
GPG Key ID: EC6DF6F90263EDEA
6 changed files with 2049 additions and 0 deletions

42
Dockerfile Normal file
View File

@ -0,0 +1,42 @@
FROM xataz/alpine:3.4
MAINTAINER xataz <https://github.com/xataz>
MAINTAINER hardware <https://github.com/hardware>
ENV GID=991 UID=991
RUN echo "@testing https://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& export BUILD_DEPS="git" \
&& apk --no-cache add nginx \
curl \
php7-phar@testing \
supervisor \
php7-fpm@testing \
php7-curl@testing \
php7-mbstring@testing \
php7-openssl@testing \
php7-json@testing \
php7-pdo_mysql@testing \
php7-gd@testing \
php7-dom@testing \
${BUILD_DEPS} \
&& cd /tmp \
&& ln -s /usr/bin/php7 /usr/bin/php \
&& curl -s http://getcomposer.org/installer | php \
&& mv /tmp/composer.phar /usr/bin/composer \
&& chmod +x /usr/bin/composer \
&& mkdir /flarum \
&& addgroup -g ${GID} flarum && adduser -h /flarum -s /bin/sh -D -G flarum -u ${UID} flarum \
&& chown flarum:flarum /flarum \
&& su-exec flarum:flarum composer create-project flarum/flarum /flarum/app --stability=beta \
&& composer clear-cache \
&& rm -rf /flarum/.composer/cache/*
COPY nginx.conf /etc/nginx/nginx.conf
COPY php.ini /etc/php7/php.ini
COPY php-fpm.conf /etc/php7/php-fpm.conf
COPY supervisord.conf /etc/supervisor/supervisord.conf
COPY startup /usr/local/bin/startup
RUN chmod +x /usr/local/bin/startup
EXPOSE 8080
CMD ["/usr/bin/tini","--","startup"]

102
nginx.conf Normal file
View File

@ -0,0 +1,102 @@
user flarum;
worker_processes auto;
pid /var/run/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 /var/log/nginx/error.log error;
sendfile on;
keepalive_timeout 15;
keepalive_disable msie6;
keepalive_requests 100;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
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 8080;
root /flarum/app;
index index.php;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log error;
charset utf-8;
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;
}
location /flarum {
deny all;
return 404;
}
location ~* \.html$ {
expires -1;
}
location ~* \.(css|js|gif|jpe?g|png)$ {
expires 1M;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
location ~ /\.ht {
deny all;
}
}
}

15
php-fpm.conf Normal file
View File

@ -0,0 +1,15 @@
[global]
daemonize = no
[www]
user = flarum
group = flarum
listen = /var/run/php-fpm.sock
listen.owner = flarum
listen.group = flarum
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /

1872
php.ini Normal file

File diff suppressed because it is too large Load Diff

10
startup Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Create user and group
# addgroup -g ${GID} flarum && adduser -h /flarum -s /bin/sh -D -G flarum -u ${UID} flarum
# Set permissions
chown -R flarum:flarum /flarum /var/lib/nginx /tmp
# RUN !
supervisord -c /etc/supervisor/supervisord.conf

8
supervisord.conf Normal file
View File

@ -0,0 +1,8 @@
[supervisord]
nodaemon=true
[program:php-fpm]
command=php-fpm7
[program:nginx]
command=nginx