From 599e7aec80b627d6a7df3b5c971beca05a72c225 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Thu, 14 Oct 2021 16:12:20 -0500 Subject: [PATCH 1/3] Use standard nginx.conf from lsio alpine nginx base image --- Dockerfile | 8 ++-- Dockerfile.aarch64 | 8 ++-- Dockerfile.armhf | 8 ++-- README.md | 3 +- package_versions.txt | 18 ++++---- readme-vars.yml | 3 +- root/app/snapdrop/client/index.html | 40 ++++++++++++++++++ root/defaults/default | 33 --------------- .../nginx/site-confs/default.conf.sample | 42 +++++++++++++++++++ root/etc/cont-init.d/50-config | 2 +- root/etc/services.d/snapdrop-server/run | 4 +- 11 files changed, 110 insertions(+), 59 deletions(-) create mode 100644 root/app/snapdrop/client/index.html delete mode 100644 root/defaults/default create mode 100644 root/defaults/nginx/site-confs/default.conf.sample diff --git a/Dockerfile b/Dockerfile index 5548188..5fd6440 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.14 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.15 # set version label ARG BUILD_DATE @@ -19,7 +19,7 @@ RUN \ apk add --no-cache --virtual=build-dependencies \ curl && \ echo "**** install snapdrop ****" && \ - mkdir -p /app/snapdrop && \ + mkdir -p /app/www && \ if [ -z ${SNAPDROP_RELEASE} ]; then \ SNAPDROP_RELEASE=$(curl -sX GET "https://api.github.com/repos/RobinLinus/snapdrop/commits/master" \ | awk '/sha/{print $4;exit}' FS='[""]'); \ @@ -29,8 +29,8 @@ RUN \ "https://github.com/RobinLinus/snapdrop/archive/${SNAPDROP_RELEASE}.tar.gz" && \ tar xf \ /tmp/snapdrop.tar.gz -C \ - /app/snapdrop/ --strip-components=1 && \ - cd /app/snapdrop/server && \ + /app/www/ --strip-components=1 && \ + cd /app/www/server && \ npm i && \ echo "**** cleanup ****" && \ apk del --purge \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 1c5ae3e..2ec2392 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.14 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.15 # set version label ARG BUILD_DATE @@ -19,7 +19,7 @@ RUN \ apk add --no-cache --virtual=build-dependencies \ curl && \ echo "**** install snapdrop ****" && \ - mkdir -p /app/snapdrop && \ + mkdir -p /app/www && \ if [ -z ${SNAPDROP_RELEASE} ]; then \ SNAPDROP_RELEASE=$(curl -sX GET "https://api.github.com/repos/RobinLinus/snapdrop/commits/master" \ | awk '/sha/{print $4;exit}' FS='[""]'); \ @@ -29,8 +29,8 @@ RUN \ "https://github.com/RobinLinus/snapdrop/archive/${SNAPDROP_RELEASE}.tar.gz" && \ tar xf \ /tmp/snapdrop.tar.gz -C \ - /app/snapdrop/ --strip-components=1 && \ - cd /app/snapdrop/server && \ + /app/www/ --strip-components=1 && \ + cd /app/www/server && \ npm i && \ echo "**** cleanup ****" && \ apk del --purge \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index b31ef05..a51f6e2 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.14 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.15 # set version label ARG BUILD_DATE @@ -19,7 +19,7 @@ RUN \ apk add --no-cache --virtual=build-dependencies \ curl && \ echo "**** install snapdrop ****" && \ - mkdir -p /app/snapdrop && \ + mkdir -p /app/www && \ if [ -z ${SNAPDROP_RELEASE} ]; then \ SNAPDROP_RELEASE=$(curl -sX GET "https://api.github.com/repos/RobinLinus/snapdrop/commits/master" \ | awk '/sha/{print $4;exit}' FS='[""]'); \ @@ -29,8 +29,8 @@ RUN \ "https://github.com/RobinLinus/snapdrop/archive/${SNAPDROP_RELEASE}.tar.gz" && \ tar xf \ /tmp/snapdrop.tar.gz -C \ - /app/snapdrop/ --strip-components=1 && \ - cd /app/snapdrop/server && \ + /app/www/ --strip-components=1 && \ + cd /app/www/server && \ npm i && \ echo "**** cleanup ****" && \ apk del --purge \ diff --git a/README.md b/README.md index 273e30b..18cfc3d 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ The architectures supported by this image are: Webui is accessible at http://SERVERIP:PORT -If you intend to expose Snapdrop to the internet, edit /config/nginx/site-confs/default and uncomment the real_ip settings +If you intend to expose Snapdrop to the internet, edit /config/nginx/site-confs/default.conf and uncomment the real_ip settings ## Usage @@ -226,5 +226,6 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **20.08.22:** - Rebasing to alpine 3.15 with php8. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base)). * **09.08.21:** - Rebase to Alpine 3.14. Add real_ip block to nginx default site config. * **15.09.20:** - Initial Release. diff --git a/package_versions.txt b/package_versions.txt index b43af26..9c8db18 100755 --- a/package_versions.txt +++ b/package_versions.txt @@ -1,13 +1,13 @@ alpine-baselayout-3.2.0-r16 alpine-keys-2.4-r0 -apache2-utils-2.4.54-r0 +apache2-utils-2.4.51-r0 apk-tools-2.12.7-r0 apr-1.7.0-r1 apr-util-1.6.1-r7 argon2-libs-20190702-r1 bash-5.1.16-r0 brotli-libs-1.0.9-r5 -busybox-1.33.1-r8 +busybox-1.33.1-r6 c-ares-1.17.2-r0 ca-certificates-20220614-r0 ca-certificates-bundle-20220614-r0 @@ -30,8 +30,8 @@ libressl3.3-libssl-3.3.6-r0 libretls-3.3.3p1-r3 libssl1.1-1.1.1q-r0 libstdc++-10.3.1_git20210424-r2 -libuuid-2.37.4-r0 -libxml2-2.9.14-r0 +libuuid-2.37.2-r0 +libxml2-2.9.12-r1 linux-pam-1.5.1-r1 logrotate-3.18.1-r3 musl-1.2.2-r3 @@ -40,13 +40,13 @@ nano-5.7-r2 ncurses-libs-6.2_p20210612-r1 ncurses-terminfo-base-6.2_p20210612-r1 nghttp2-libs-1.43.0-r0 -nginx-1.20.2-r1 -nodejs-14.20.0-r0 +nginx-1.20.2-r0 +nodejs-14.18.1-r0 npm-7.17.0-r0 oniguruma-6.9.7.1-r0 openssl-1.1.1q-r0 pcre-8.44-r0 -pcre2-10.36-r1 +pcre2-10.36-r0 php7-7.4.26-r0 php7-common-7.4.26-r0 php7-fileinfo-7.4.26-r0 @@ -65,8 +65,8 @@ s6-ipcserver-2.10.0.3-r0 scanelf-1.3.2-r0 shadow-4.8.1-r0 skalibs-2.10.0.3-r0 -ssl_client-1.33.1-r8 -tzdata-2022a-r0 +ssl_client-1.33.1-r6 +tzdata-2021e-r0 utmps-0.1.0.2-r0 xz-5.2.5-r1 xz-libs-5.2.5-r1 diff --git a/readme-vars.yml b/readme-vars.yml index 0d531fc..034ac43 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -63,9 +63,10 @@ app_setup_block_enabled: true app_setup_block: | Webui is accessible at http://SERVERIP:PORT - If you intend to expose Snapdrop to the internet, edit /config/nginx/site-confs/default and uncomment the real_ip settings + If you intend to expose Snapdrop to the internet, edit /config/nginx/site-confs/default.conf and uncomment the real_ip settings # changelog changelogs: + - { date: "20.08.22:", desc: "Rebasing to alpine 3.15 with php8. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base))." } - { date: "09.08.21:", desc: "Rebase to Alpine 3.14. Add real_ip block to nginx default site config." } - { date: "15.09.20:", desc: "Initial Release." } diff --git a/root/app/snapdrop/client/index.html b/root/app/snapdrop/client/index.html new file mode 100644 index 0000000..2ac31be --- /dev/null +++ b/root/app/snapdrop/client/index.html @@ -0,0 +1,40 @@ + + + Upgrade Required! + + + +
+

Upgrade Required!

+

The application inside this image has been moved to a new folder.

+

You will need to update your /config/nginx/nginx.conf and /config/nginx/site-confs/default.conf in order for the application to work.

+

New config samples are located at /config/nginx/nginx.conf.sample and /config/nginx/site-confs/default.conf.sample

+

Please review our announcement: Significant changes to nginx based images

+
+ + diff --git a/root/defaults/default b/root/defaults/default deleted file mode 100644 index fefdce7..0000000 --- a/root/defaults/default +++ /dev/null @@ -1,33 +0,0 @@ -server { - listen 80 default_server; - - listen 443 ssl; - - root /app/snapdrop/client; - index index.php index.html index.htm; - - server_name _; - - ssl_certificate /config/keys/cert.crt; - ssl_certificate_key /config/keys/cert.key; - - client_max_body_size 0; - - # Uncomment the block below and update the "set_real_ip" with the address/range of your reverse proxy if you intend to expose Snapdrop to the internet - #set_real_ip_from 127.0.0.1/32; - #real_ip_header X-Forwarded-For; - #real_ip_recursive on; - - location / { - root /app/snapdrop/client; - index index.html index.htm; - } - - location /server { - proxy_connect_timeout 300; - proxy_pass http://localhost:3000; - proxy_set_header Connection "upgrade"; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header X-Forwarded-for $remote_addr; - } -} diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample new file mode 100644 index 0000000..0495a2a --- /dev/null +++ b/root/defaults/nginx/site-confs/default.conf.sample @@ -0,0 +1,42 @@ +## Version 2022/08/20 - Changelog: https://github.com/linuxserver/docker-snapdrop/commits/master/root/defaults/nginx/site-confs/default.conf.sample + +server { + listen 80 default_server; + listen [::]:80 default_server; + + listen 443 ssl http2; + listen [::]:443 ssl http2; + + server_name _; + + root /app/www/client; + index index.html index.htm index.php; + + location / { + # enable for basic auth + #auth_basic "Restricted"; + #auth_basic_user_file /config/nginx/.htpasswd; + + try_files $uri $uri/ /index.html /index.php?$args =404; + } + + location /server { + proxy_connect_timeout 300; + proxy_pass http://localhost:3000; + proxy_set_header Connection "upgrade"; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header X-Forwarded-for $remote_addr; + } + + location ~ ^(.+\.php)(.*)$ { + fastcgi_split_path_info ^(.+\.php)(.*)$; + fastcgi_pass 127.0.0.1:9000; + fastcgi_index index.php; + include /etc/nginx/fastcgi_params; + } + + # deny access to .htaccess/.htpasswd files + location ~ /\.ht { + deny all; + } +} diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 4a5264a..05c4707 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -2,4 +2,4 @@ # permissions chown -R abc:abc \ - /config + /config diff --git a/root/etc/services.d/snapdrop-server/run b/root/etc/services.d/snapdrop-server/run index ebaaa20..15a6b51 100644 --- a/root/etc/services.d/snapdrop-server/run +++ b/root/etc/services.d/snapdrop-server/run @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash -cd /app/snapdrop/server || exit +cd /app/www/server || exit 1 exec \ - s6-setuidgid abc /usr/bin/node index.js + s6-setuidgid abc /usr/bin/node index.js From 760d6b3f4cc49401eb09f1c1e82eeab54fcaa587 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Sat, 20 Aug 2022 18:55:17 -0500 Subject: [PATCH 2/3] Add default location migration --- root/migrations/02-default-location | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 root/migrations/02-default-location diff --git a/root/migrations/02-default-location b/root/migrations/02-default-location new file mode 100644 index 0000000..3d3d2f8 --- /dev/null +++ b/root/migrations/02-default-location @@ -0,0 +1,10 @@ +#!/usr/bin/with-contenv bash + +DEFAULT_CONF="/config/nginx/site-confs/default.conf" +OLD_ROOT="root /app/snapdrop/client;" +NEW_ROOT="root /app/www/client;" + +if grep -q "${OLD_ROOT}" "${DEFAULT_CONF}";then + echo "updating root in ${DEFAULT_CONF}" + sed -i "s|${OLD_ROOT}|${NEW_ROOT}|" "${DEFAULT_CONF}" +fi From 95b174a865cd61f0e5b152a7c48941fc0693cc1e Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Sun, 21 Aug 2022 17:05:51 -0500 Subject: [PATCH 3/3] Keep /config volume consistently --- Dockerfile | 4 ++++ Dockerfile.aarch64 | 4 ++++ Dockerfile.armhf | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/Dockerfile b/Dockerfile index 5fd6440..17afaf6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,3 +41,7 @@ RUN \ # copy local files COPY root/ / + +# ports and volumes +EXPOSE 80 443 +VOLUME /config diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 2ec2392..5a53bda 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -41,3 +41,7 @@ RUN \ # copy local files COPY root/ / + +# ports and volumes +EXPOSE 80 443 +VOLUME /config diff --git a/Dockerfile.armhf b/Dockerfile.armhf index a51f6e2..9350bbb 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -41,3 +41,7 @@ RUN \ # copy local files COPY root/ / + +# ports and volumes +EXPOSE 80 443 +VOLUME /config