From 1c3f239b89e15ba4895c07e245a6bd6dea83dd61 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com> Date: Sun, 9 Feb 2020 13:55:56 -0500 Subject: [PATCH] Added ENV VAR setting for which port to run, flarum on inside the container. (#45) --- Dockerfile | 6 ++++-- README.md | 3 ++- rootfs/etc/nginx/nginx.conf | 2 +- rootfs/usr/local/bin/startup | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index bddf69a..38ee806 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,8 @@ ENV GID=991 \ FLARUM_TITLE=Docker-Flarum \ DEBUG=false \ LOG_TO_STDOUT=false \ - GITHUB_TOKEN_AUTH=false + GITHUB_TOKEN_AUTH=false \ + FLARUM_PORT=8888 RUN apk add --no-progress --no-cache \ nginx \ @@ -25,6 +26,7 @@ RUN apk add --no-progress --no-cache \ su-exec \ curl \ git \ + libcap \ php7 \ php7-fileinfo \ php7-phar \ @@ -57,6 +59,6 @@ RUN apk add --no-progress --no-cache \ COPY rootfs / RUN chmod +x /usr/local/bin/* /services/*/run /services/.s6-svscan/* +RUN setcap CAP_NET_BIND_SERVICE=+eip /usr/sbin/nginx VOLUME /flarum/app/extensions /etc/nginx/conf.d -EXPOSE 8888 CMD ["/usr/local/bin/startup"] diff --git a/README.md b/README.md index e96a6ec..973c0dd 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Simple forum software for building great communities. https://flarum.org/ ### Ports -- **8888** +- Default: **8888** (configurable) ### Volume @@ -47,6 +47,7 @@ Simple forum software for building great communities. https://flarum.org/ | **DB_PASS** | MariaDB database password | **required** | none | **DB_PREF** | Flarum tables prefix | *optional* | none | **DB_PORT** | MariaDB database port | *optional* | 3306 +| **FLARUM_PORT** | Port to run Flarum on inside the container | *optional* | 8888 | **UPLOAD_MAX_SIZE** | The maximum size of an uploaded file | *optional* | 50M | **PHP_MEMORY_LIMIT** | PHP memory limit | *optional* | 128M | | **OPCACHE_MEMORY_LIMIT** | OPcache memory size in megabytes | *optional* | 128 diff --git a/rootfs/etc/nginx/nginx.conf b/rootfs/etc/nginx/nginx.conf index 2b3d99b..53ba09e 100644 --- a/rootfs/etc/nginx/nginx.conf +++ b/rootfs/etc/nginx/nginx.conf @@ -53,7 +53,7 @@ http { image/svg+xml; server { - listen 8888; + listen ; charset utf-8; root /flarum/app/public; diff --git a/rootfs/usr/local/bin/startup b/rootfs/usr/local/bin/startup index b115b82..8125593 100644 --- a/rootfs/usr/local/bin/startup +++ b/rootfs/usr/local/bin/startup @@ -12,6 +12,7 @@ if [ -z "${FORUM_URL}" ]; then fi # Set file config for nginx and php +sed -i "s//${FLARUM_PORT}/g" /etc/nginx/nginx.conf sed -i "s//${UPLOAD_MAX_SIZE}/g" /etc/nginx/nginx.conf /etc/php7/php-fpm.conf sed -i "s//${PHP_MEMORY_LIMIT}/g" /etc/php7/php-fpm.conf sed -i "s//${OPCACHE_MEMORY_LIMIT}/g" /etc/php7/conf.d/00_opcache.ini