From e8e640297bf24c28b546ad6d3eda94ac07cc50ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Thu, 10 Mar 2022 01:39:27 +0100 Subject: [PATCH] Initial commit --- Dockerfile | 67 ++++++++++++++++++++++++++++++++++++++++++ nginx/nginx.conf.patch | 19 ++++++++++++ nginx/run_nginx.sh | 6 ++++ zzz-kiwi.conf | 2 ++ 4 files changed, 94 insertions(+) create mode 100644 Dockerfile create mode 100644 nginx/nginx.conf.patch create mode 100644 nginx/run_nginx.sh create mode 100644 zzz-kiwi.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..81f0dae --- /dev/null +++ b/Dockerfile @@ -0,0 +1,67 @@ +ARG NC_VERSION=22 +FROM nextcloud:${NC_VERSION}-fpm-alpine +LABEL maintainer="jmm@yavook.de" + +######### +# add s6 overlay +# https://github.com/just-containers/s6-overlay +######### + +ARG S6_OVERLAY_VERSION=3.0.0.2-2 +ENV PATH=/command:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +RUN set -ex; \ + \ + curl \ + --proto '=https' --tlsv1.2 -sSLf \ + "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch-${S6_OVERLAY_VERSION}.tar.xz" \ + | tar -JxpC /; \ + curl \ + --proto '=https' --tlsv1.2 -sSLf \ + "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64-${S6_OVERLAY_VERSION}.tar.xz" \ + | tar -JxpC /; \ + \ + echo "${PATH}" > /etc/s6-overlay/config/global_path; + +ENTRYPOINT [ "/init" ] + +# with-contenv + original container ENTRYPOINT + original container CMD +CMD [ "/command/with-contenv", "/entrypoint.sh", "php-fpm" ] + +######### +# configure php-fpm +######### + +COPY zzz-kiwi.conf /usr/local/etc/php-fpm.d/zzz-kiwi.conf; + +######### +# add nginx +######### + +COPY nginx /opt/nginx + +# add nginx.conf from examples: https://github.com/nextcloud/docker/tree/master/.examples +ADD \ + https://raw.githubusercontent.com/nextcloud/docker/master/.examples/docker-compose/insecure/mariadb/fpm/web/nginx.conf \ + /opt/nginx/nginx.conf + +RUN set -ex; \ + \ + apk --no-cache add \ + nginx \ + patch \ + ; \ + \ + cd /opt/nginx; \ + # install nginx.conf + patch -p1 < nginx.conf.patch; \ + rm nginx.conf.patch; \ + mv nginx.conf /etc/nginx/nginx.conf; \ + \ + mkdir -p /etc/s6-overlay/s6-rc.d/run_nginx; \ + mv run_nginx.sh /etc/s6-overlay/s6-rc.d/run_nginx/run; \ + echo 'longrun' > /etc/s6-overlay/s6-rc.d/run_nginx/type; \ + touch /etc/s6-overlay/s6-rc.d/user/contents.d/run_nginx; \ + \ + apk --no-cache del patch; \ + cd /; rmdir /opt/nginx; diff --git a/nginx/nginx.conf.patch b/nginx/nginx.conf.patch new file mode 100644 index 0000000..5fdf58d --- /dev/null +++ b/nginx/nginx.conf.patch @@ -0,0 +1,19 @@ +--- a/nginx.conf 2022-03-10 00:55:28.560012495 +0100 ++++ b/nginx.conf 2022-03-10 01:13:07.179416962 +0100 +@@ -27,9 +27,15 @@ + #gzip on; + + upstream php-handler { +- server app:9000; ++ server 127.0.0.1:9000; + } + ++ set_real_ip_from 10.0.0.0/8; ++ set_real_ip_from 172.16.0.0/12; ++ set_real_ip_from 192.168.0.0/16; ++ real_ip_header X-Forwarded-For; ++ real_ip_recursive on; ++ + server { + listen 80; + diff --git a/nginx/run_nginx.sh b/nginx/run_nginx.sh new file mode 100644 index 0000000..7138dd4 --- /dev/null +++ b/nginx/run_nginx.sh @@ -0,0 +1,6 @@ +#!/command/with-contenv sh +# shellcheck shell=sh + +nginx_exe="$( command -v nginx )" + +exec "${nginx_exe}" "-g" "daemon off;" diff --git a/zzz-kiwi.conf b/zzz-kiwi.conf new file mode 100644 index 0000000..e550e3f --- /dev/null +++ b/zzz-kiwi.conf @@ -0,0 +1,2 @@ +[www] +listen = 127.0.0.1:9000