diff --git a/Dockerfile b/Dockerfile index 756148f..99d5420 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.15-php8 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.15 # set version label ARG BUILD_DATE @@ -10,8 +10,7 @@ LABEL maintainer="hackerman" RUN \ echo "**** install build packages ****" && \ apk add --no-cache --virtual=build-dependencies \ - composer \ - git && \ + composer && \ echo "**** install runtime packages ****" && \ apk add --no-cache \ curl \ @@ -25,18 +24,22 @@ RUN \ php8-dom \ php8-exif \ php8-gd \ - php8-pecl-imagick \ php8-intl \ php8-json \ php8-mbstring \ php8-mysqli \ php8-pdo_mysql \ + php8-pecl-imagick \ + php8-phar \ php8-session \ php8-tokenizer \ php8-xml \ php8-zip && \ + echo "**** configure php-fpm to pass env vars ****" && \ + sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php8/php-fpm.d/www.conf && \ + grep -qxF 'clear_env = no' /etc/php8/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php8/php-fpm.d/www.conf && \ echo "**** install lychee ****" && \ - mkdir -p /app/lychee && \ + mkdir -p /app/www && \ if [ -z ${LYCHEE_VERSION} ]; then \ LYCHEE_VERSION=$(curl -sX GET "https://api.github.com/repos/LycheeOrg/Lychee/releases/latest" \ | awk '/tag_name/{print $4;exit}' FS='[""]'); \ @@ -45,12 +48,12 @@ RUN \ /tmp/lychee.tar.gz -L \ "https://github.com/LycheeOrg/Lychee/archive/${LYCHEE_VERSION}.tar.gz" && \ tar xf \ - /tmp/lychee.tar.gz -C \ - /app/lychee/ --strip-components=1 && \ - cd /app/lychee && \ + /tmp/lychee.tar.gz -C \ + /app/www/ --strip-components=1 && \ + cd /app/www && \ echo "**** install composer dependencies ****" && \ composer install \ - -d /app/lychee \ + -d /app/www \ --no-dev \ --no-suggest \ --no-interaction && \ @@ -64,3 +67,6 @@ RUN \ # add local files COPY root/ / + +# ports and volumes +EXPOSE 80 443 diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 68d71c8..f10ff03 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.15-php8 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.15 # set version label ARG BUILD_DATE @@ -10,8 +10,7 @@ LABEL maintainer="hackerman" RUN \ echo "**** install build packages ****" && \ apk add --no-cache --virtual=build-dependencies \ - composer \ - git && \ + composer && \ echo "**** install runtime packages ****" && \ apk add --no-cache \ curl \ @@ -25,18 +24,22 @@ RUN \ php8-dom \ php8-exif \ php8-gd \ - php8-pecl-imagick \ php8-intl \ php8-json \ php8-mbstring \ php8-mysqli \ php8-pdo_mysql \ + php8-pecl-imagick \ + php8-phar \ php8-session \ php8-tokenizer \ php8-xml \ php8-zip && \ + echo "**** configure php-fpm to pass env vars ****" && \ + sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php8/php-fpm.d/www.conf && \ + grep -qxF 'clear_env = no' /etc/php8/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php8/php-fpm.d/www.conf && \ echo "**** install lychee ****" && \ - mkdir -p /app/lychee && \ + mkdir -p /app/www && \ if [ -z ${LYCHEE_VERSION} ]; then \ LYCHEE_VERSION=$(curl -sX GET "https://api.github.com/repos/LycheeOrg/Lychee/releases/latest" \ | awk '/tag_name/{print $4;exit}' FS='[""]'); \ @@ -45,12 +48,12 @@ RUN \ /tmp/lychee.tar.gz -L \ "https://github.com/LycheeOrg/Lychee/archive/${LYCHEE_VERSION}.tar.gz" && \ tar xf \ - /tmp/lychee.tar.gz -C \ - /app/lychee/ --strip-components=1 && \ - cd /app/lychee && \ + /tmp/lychee.tar.gz -C \ + /app/www/ --strip-components=1 && \ + cd /app/www && \ echo "**** install composer dependencies ****" && \ composer install \ - -d /app/lychee \ + -d /app/www \ --no-dev \ --no-suggest \ --no-interaction && \ @@ -59,6 +62,7 @@ RUN \ build-dependencies && \ rm -rf \ /root/.cache \ + /root/.composer \ /tmp/* # add local files diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 63bc1ea..963a4f7 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.15-php8 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.15 # set version label ARG BUILD_DATE @@ -10,8 +10,7 @@ LABEL maintainer="hackerman" RUN \ echo "**** install build packages ****" && \ apk add --no-cache --virtual=build-dependencies \ - composer \ - git && \ + composer && \ echo "**** install runtime packages ****" && \ apk add --no-cache \ curl \ @@ -25,18 +24,22 @@ RUN \ php8-dom \ php8-exif \ php8-gd \ - php8-pecl-imagick \ php8-intl \ php8-json \ php8-mbstring \ php8-mysqli \ php8-pdo_mysql \ + php8-pecl-imagick \ + php8-phar \ php8-session \ php8-tokenizer \ php8-xml \ php8-zip && \ + echo "**** configure php-fpm to pass env vars ****" && \ + sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php8/php-fpm.d/www.conf && \ + grep -qxF 'clear_env = no' /etc/php8/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php8/php-fpm.d/www.conf && \ echo "**** install lychee ****" && \ - mkdir -p /app/lychee && \ + mkdir -p /app/www && \ if [ -z ${LYCHEE_VERSION} ]; then \ LYCHEE_VERSION=$(curl -sX GET "https://api.github.com/repos/LycheeOrg/Lychee/releases/latest" \ | awk '/tag_name/{print $4;exit}' FS='[""]'); \ @@ -45,12 +48,12 @@ RUN \ /tmp/lychee.tar.gz -L \ "https://github.com/LycheeOrg/Lychee/archive/${LYCHEE_VERSION}.tar.gz" && \ tar xf \ - /tmp/lychee.tar.gz -C \ - /app/lychee/ --strip-components=1 && \ - cd /app/lychee && \ + /tmp/lychee.tar.gz -C \ + /app/www/ --strip-components=1 && \ + cd /app/www && \ echo "**** install composer dependencies ****" && \ composer install \ - -d /app/lychee \ + -d /app/www \ --no-dev \ --no-suggest \ --no-interaction && \ @@ -59,6 +62,7 @@ RUN \ build-dependencies && \ rm -rf \ /root/.cache \ + /root/.composer \ /tmp/* # add local files diff --git a/README.md b/README.md index 479722f..8a71ddb 100644 --- a/README.md +++ b/README.md @@ -260,7 +260,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions -* **04.12.21:** - Rebase to alpine 3.15 with php8. +* **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)). * **13.05.21:** - Make readme clearer. * **18.04.21:** - Add php-intl for v4.3. * **31.01.21:** - Add jpegoptim. diff --git a/package_versions.txt b/package_versions.txt index 65d4a46..25fe363 100755 --- a/package_versions.txt +++ b/package_versions.txt @@ -2,38 +2,38 @@ alpine-baselayout-3.2.0-r18 alpine-keys-2.4-r1 alsa-lib-1.2.5.1-r1 aom-libs-3.2.0-r0 -apache2-utils-2.4.54-r0 +apache2-utils-2.4.51-r1 apk-tools-2.12.7-r3 -apr-1.7.0-r1 +apr-1.7.0-r0 apr-util-1.6.1-r11 argon2-libs-20190702-r1 avahi-libs-0.8-r5 -bash-5.1.16-r0 +bash-5.1.8-r0 brotli-libs-1.0.9-r5 -busybox-1.34.1-r7 -ca-certificates-20220614-r0 -ca-certificates-bundle-20220614-r0 -cairo-1.16.0-r5 -cairo-gobject-1.16.0-r5 +busybox-1.34.1-r3 +ca-certificates-20191127-r7 +ca-certificates-bundle-20191127-r7 +cairo-1.16.0-r3 +cairo-gobject-1.16.0-r3 coreutils-9.0-r2 -cups-libs-2.3.3-r6 -curl-7.80.0-r2 +cups-libs-2.3.3-r4 +curl-7.80.0-r0 dbus-libs-1.12.20-r4 exiftool-12.30-r0 -expat-2.4.7-r0 +expat-2.4.1-r0 ffmpeg-4.4.1-r2 ffmpeg-libs-4.4.1-r2 fontconfig-2.13.1-r4 -freetype-2.11.1-r2 +freetype-2.11.0-r0 fribidi-1.0.11-r0 gd-2.3.2-r1 -gdk-pixbuf-2.42.8-r0 +gdk-pixbuf-2.42.6-r0 ghostscript-9.55.0-r0 -git-2.34.4-r0 -git-perl-2.34.4-r0 +git-2.34.1-r0 +git-perl-2.34.1-r0 glib-2.70.1-r0 -gmp-6.2.1-r1 -gnutls-3.7.1-r1 +gmp-6.2.1-r0 +gnutls-3.7.1-r0 graphite2-1.3.14-r0 harfbuzz-3.0.0-r2 icu-libs-69.1-r1 @@ -46,14 +46,14 @@ lcms2-2.12-r1 libacl-2.2.53-r0 libass-0.15.2-r0 libattr-2.5.1-r1 -libblkid-2.37.4-r0 +libblkid-2.37.2-r1 libbsd-0.11.3-r1 libbz2-1.0.8-r1 libc-utils-0.7.2-r3 -libcrypto1.1-1.1.1q-r0 -libcurl-7.80.0-r2 +libcrypto1.1-1.1.1l-r7 +libcurl-7.80.0-r0 libdav1d-0.9.2-r0 -libde265-1.0.8-r2 +libde265-1.0.8-r1 libdrm-2.4.109-r0 libedit-20210910.3.1-r0 libffi-3.4.2-r1 @@ -66,29 +66,29 @@ libintl-0.21-r0 libjpeg-turbo-2.1.2-r0 libltdl-2.4.6-r7 libmd-1.0.3-r0 -libmount-2.37.4-r0 +libmount-2.37.2-r1 libogg-1.3.5-r0 libpciaccess-0.16-r0 libpng-1.6.37-r1 libproc-3.3.17-r0 -libressl3.4-libcrypto-3.4.3-r0 -libressl3.4-libssl-3.4.3-r0 -libretls-3.3.4-r3 +libressl3.4-libcrypto-3.4.1-r0 +libressl3.4-libssl-3.4.1-r0 +libretls-3.3.4-r2 librsvg-2.50.7-r1 libsm-1.2.3-r0 libsrt-1.4.2-r1 libssh-0.9.6-r1 -libssl1.1-1.1.1q-r0 +libssl1.1-1.1.1l-r7 libstdc++-10.3.1_git20211027-r0 libtasn1-4.18.0-r0 libtheora-1.1.1-r16 libunistring-0.9.10-r1 -libuuid-2.37.4-r0 +libuuid-2.37.2-r1 libva-2.13.0-r0 libvdpau-1.4-r0 libvorbis-1.3.7-r0 libvpx-1.10.0-r0 -libwebp-1.2.2-r0 +libwebp-1.2.1-r0 libx11-1.7.2-r0 libxau-1.0.9-r0 libxcb-1.14-r2 @@ -96,55 +96,55 @@ libxdmcp-1.1.3-r0 libxext-1.3.4-r0 libxfixes-6.0.0-r0 libxft-2.3.4-r0 -libxml2-2.9.14-r0 +libxml2-2.9.12-r2 libxpm-3.5.13-r0 libxrender-0.9.10-r3 libxt-1.2.1-r0 libzip-1.8.0-r1 linux-pam-1.5.2-r0 -logrotate-3.18.1-r3 +logrotate-3.18.1-r0 musl-1.2.2-r7 musl-utils-1.2.2-r7 nano-5.9-r0 -ncurses-libs-6.3_p20211120-r1 -ncurses-terminfo-base-6.3_p20211120-r1 +ncurses-libs-6.3_p20211120-r0 +ncurses-terminfo-base-6.3_p20211120-r0 nettle-3.7.3-r0 nghttp2-libs-1.46.0-r0 -nginx-1.20.2-r1 +nginx-1.20.2-r0 oniguruma-6.9.7.1-r0 -openssl-1.1.1q-r0 +openssl-1.1.1l-r7 opus-1.3.1-r1 p11-kit-0.24.0-r1 pango-1.48.10-r0 pcre-8.45-r1 -pcre2-10.40-r0 +pcre2-10.39-r0 perl-5.34.0-r1 perl-error-0.17029-r1 -perl-git-2.34.4-r0 +perl-git-2.34.1-r0 perl-image-exiftool-12.30-r0 -php8-8.0.18-r0 -php8-bcmath-8.0.18-r0 -php8-common-8.0.18-r0 -php8-ctype-8.0.18-r0 -php8-dom-8.0.18-r0 -php8-exif-8.0.18-r0 -php8-fileinfo-8.0.18-r0 -php8-fpm-8.0.18-r0 -php8-gd-8.0.18-r0 -php8-intl-8.0.18-r0 -php8-mbstring-8.0.18-r0 -php8-mysqli-8.0.18-r0 -php8-mysqlnd-8.0.18-r0 -php8-openssl-8.0.18-r0 -php8-pdo-8.0.18-r0 -php8-pdo_mysql-8.0.18-r0 +php8-8.0.13-r0 +php8-bcmath-8.0.13-r0 +php8-common-8.0.13-r0 +php8-ctype-8.0.13-r0 +php8-dom-8.0.13-r0 +php8-exif-8.0.13-r0 +php8-fileinfo-8.0.13-r0 +php8-fpm-8.0.13-r0 +php8-gd-8.0.13-r0 +php8-intl-8.0.13-r0 +php8-mbstring-8.0.13-r0 +php8-mysqli-8.0.13-r0 +php8-mysqlnd-8.0.13-r0 +php8-openssl-8.0.13-r0 +php8-pdo-8.0.13-r0 +php8-pdo_mysql-8.0.13-r0 php8-pecl-imagick-3.6.0-r0 -php8-session-8.0.18-r0 -php8-simplexml-8.0.18-r0 -php8-tokenizer-8.0.18-r0 -php8-xml-8.0.18-r0 -php8-xmlwriter-8.0.18-r0 -php8-zip-8.0.18-r0 +php8-session-8.0.13-r0 +php8-simplexml-8.0.13-r0 +php8-tokenizer-8.0.13-r0 +php8-xml-8.0.13-r0 +php8-xmlwriter-8.0.13-r0 +php8-zip-8.0.13-r0 pixman-0.40.0-r3 pkgconf-1.8.0-r0 popt-1.18-r0 @@ -157,9 +157,9 @@ shadow-4.8.1-r1 shared-mime-info-2.1-r0 skalibs-2.11.0.0-r0 soxr-0.1.3-r2 -ssl_client-1.34.1-r7 -tiff-4.3.0-r1 -tzdata-2022a-r0 +ssl_client-1.34.1-r3 +tiff-4.3.0-r0 +tzdata-2021e-r0 utmps-0.1.0.3-r0 v4l-utils-libs-1.22.1-r1 vidstab-1.1.0-r1 @@ -168,7 +168,7 @@ wayland-libs-client-1.19.0-r1 x264-libs-20210613-r0 x265-libs-3.5-r0 xvidcore-1.3.7-r1 -xz-5.2.5-r1 -xz-libs-5.2.5-r1 -zlib-1.2.12-r1 +xz-5.2.5-r0 +xz-libs-5.2.5-r0 +zlib-1.2.11-r3 zstd-libs-1.5.0-r0 diff --git a/readme-vars.yml b/readme-vars.yml index d45dd58..d02f984 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -88,7 +88,7 @@ app_setup_block: | # changelog changelogs: - - { date: "04.12.21:", desc: "Rebase to alpine 3.15 with php8." } + - { 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: "13.05.21:", desc: "Make readme clearer." } - { date: "18.04.21:", desc: "Add php-intl for v4.3." } - { date: "31.01.21:", desc: "Add jpegoptim." } diff --git a/root/app/lychee/public/index.html b/root/app/lychee/public/index.html new file mode 100644 index 0000000..2ac31be --- /dev/null +++ b/root/app/lychee/public/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 16d4816..0000000 --- a/root/defaults/default +++ /dev/null @@ -1,33 +0,0 @@ -server { - listen 80 default_server; - - listen 443 ssl; - - root /app/lychee/public; - 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; - - location / { - try_files $uri $uri/ /index.php?$query_string; - } - - # unless the request is for a valid file (image, js, css, etc.), send to bootstrap - if (!-e $request_filename) - { - rewrite ^/(.*)$ /index.php?/$1 last; - break; - } - - location ~ \.php$ { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass 127.0.0.1:9000; - fastcgi_index index.php; - include /etc/nginx/fastcgi_params; - } -} 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..1873243 --- /dev/null +++ b/root/defaults/nginx/site-confs/default.conf.sample @@ -0,0 +1,44 @@ +## Version 2022/08/20 - Changelog: https://github.com/linuxserver/docker-lychee/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 _; + + set $root /app/www/public; + if (!-d /app/www/public) { + set $root /config/www; + } + root $root; + 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; + } + + # unless the request is for a valid file (image, js, css, etc.), send to bootstrap + if (!-e $request_filename) { + rewrite ^/(.*)$ /index.php?/$1 last; + break; + } + + 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/40-config b/root/etc/cont-init.d/40-config index c46735a..c912294 100644 --- a/root/etc/cont-init.d/40-config +++ b/root/etc/cont-init.d/40-config @@ -2,30 +2,35 @@ mkdir -p /pictures -cd /app/lychee +cd /app/www # copy config -[[ ! -e /config/user.ini ]] && \ +if [[ ! -e /config/user.ini ]]; then cp /defaults/user.ini /config/user.ini +fi cp /config/user.ini /etc/php8/conf.d/99-user.ini # pre-populate /pictures directory if it's empty if [ ! "$(ls -A /pictures)" ]; then - mv /app/lychee/public/uploads/* /pictures/ + mv /app/www/public/uploads/* /pictures/ chown -R abc:abc /pictures elif [ ! "$(ls -A /pictures/import 2>/dev/null)" ]; then printf "\n\n\n\nSeems like you tried to use a path thats not managed by lychee, this is unsupported\n\n\n\n" fi -[[ ! -L "/app/lychee/public/uploads" ]] && rm -rf /app/lychee/public/uploads && ln -sf /pictures /app/lychee/public/uploads +if [[ ! -L "/app/www/public/uploads" ]]; then + rm -rf /app/www/public/uploads + ln -sf /pictures /app/www/public/uploads +fi # handle storage directory -[[ ! -e "/config/storage" ]] && \ - mv /app/lychee/storage /config/ +if [[ ! -e "/config/storage" ]]; then + mv /app/www/storage /config/ +fi -rm -rf /app/lychee/storage -ln -s /config/storage /app/lychee/storage -ln -sf /config/.env /app/lychee/.env +rm -rf /app/www/storage +ln -s /config/storage /app/www/storage +ln -sf /config/.env /app/www/.env # check for .env and copy default if needed if [ ! -f "/config/.env" ]; then @@ -39,7 +44,7 @@ if [ ! -f "/config/.env" ]; then done # populate config from variables - cp /app/lychee/.env.example /config/.env + cp /app/www/.env.example /config/.env echo "Populating config from variables" sed -i "s|DB_CONNECTION=sqlite|DB_CONNECTION=mysql|g" /config/.env @@ -54,13 +59,13 @@ if [ ! -f "/config/.env" ]; then php artisan migrate --force elif [ -f "/config/lychee/config.php" ]; then # attempt upgrade - cp /app/lychee/.env.example /config/.env + cp /app/www/.env.example /config/.env php /defaults/upgrade.php mv /config/lychee /config/lychee.old # force nginx config upgrade - mv /config/nginx/site-confs/default /config/nginx/default.bak - mv /defaults/default /config/nginx/site-confs/default + mv /config/nginx/site-confs/default.conf /config/nginx/site-confs/default.conf.bak + cp /defaults/nginx/site-confs/default.conf.sample /config/nginx/site-confs/default.conf php artisan key:generate php artisan migrate --force @@ -79,11 +84,7 @@ else php artisan migrate --force fi -# add line to preserve environment variables in FPM so Lychee can use $PATH (for things like ffprobe) -sed -E -i 's/^clear_env =.*$/clear_env = no/g' /config/php/www2.conf -grep -qxF 'clear_env = no' /config/php/www2.conf || echo 'clear_env = no' >> /config/php/www2.conf - # permissions chown -R abc:abc \ - /app/lychee \ + /app/www \ /config