diff --git a/Dockerfile b/Dockerfile index 67c9c8a..a0ae7ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.15 +# syntax=docker/dockerfile:1 + +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.17 # set version label ARG BUILD_DATE @@ -10,45 +12,45 @@ LABEL maintainer="TheSpad" RUN \ echo "**** install runtime packages ****" && \ apk add -U --upgrade --no-cache \ - curl \ - php8-bcmath \ - php8-bz2 \ - php8-cli \ - php8-ctype \ - php8-curl \ - php8-dom \ - php8-fileinfo \ - php8-gd \ - php8-gettext \ - php8-gmp \ - php8-iconv \ - php8-json \ - php8-mbstring \ - php8-mysqli \ - php8-openssl \ - php8-pdo \ - php8-pdo_dblib \ - php8-pdo_mysql \ - php8-pecl-apcu \ - php8-pecl-mcrypt \ - php8-pecl-memcached \ - php8-phar \ - php8-soap \ - php8-xmlreader \ - php8-zip \ - unzip && \ + php81-bcmath \ + php81-bz2 \ + php81-cli \ + php81-ctype \ + php81-curl \ + php81-dom \ + php81-fileinfo \ + php81-gd \ + php81-gettext \ + php81-gmp \ + php81-iconv \ + php81-json \ + php81-mbstring \ + php81-mysqli \ + php81-openssl \ + php81-pdo \ + php81-pdo_dblib \ + php81-pdo_mysql \ + php81-pecl-apcu \ + php81-pecl-memcached \ + php81-phar \ + php81-soap \ + php81-xmlreader \ + php81-zip && \ apk add --no-cache \ --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ - php8-pecl-xmlrpc && \ + php81-pecl-mcrypt \ + php81-pecl-xmlrpc && \ echo "**** install projectsend ****" && \ mkdir -p /app/www/public && \ if [ -z ${PROJECTSEND_VERSION+x} ]; then \ - PROJECTSEND_VERSION=$(curl -sX GET "https://api.github.com/repos/projectsend/projectsend/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ + PROJECTSEND_VERSION=$(curl -s https://api.github.com/repos/projectsend/projectsend/releases/latest | jq -r '. | .tag_name'); \ fi && \ - curl -s -o \ + curl -fso \ /tmp/projectsend.zip -L \ - "https://github.com/projectsend/projectsend/releases/download/${PROJECTSEND_VERSION}/projectsend-${PROJECTSEND_VERSION}.zip" && \ + "https://github.com/projectsend/projectsend/releases/download/${PROJECTSEND_VERSION}/projectsend-${PROJECTSEND_VERSION}.zip" || \ + curl -fso \ + /tmp/projectsend.zip -L \ + "https://github.com/projectsend/projectsend/releases/download/${PROJECTSEND_VERSION}/projectsend.zip" && \ unzip \ /tmp/projectsend.zip -d \ /app/www/public && \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 46cdd5c..e4b166b 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,4 +1,6 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.15 +# syntax=docker/dockerfile:1 + +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.17 # set version label ARG BUILD_DATE @@ -10,45 +12,45 @@ LABEL maintainer="TheSpad" RUN \ echo "**** install runtime packages ****" && \ apk add -U --upgrade --no-cache \ - curl \ - php8-bcmath \ - php8-bz2 \ - php8-cli \ - php8-ctype \ - php8-curl \ - php8-dom \ - php8-fileinfo \ - php8-gd \ - php8-gettext \ - php8-gmp \ - php8-iconv \ - php8-json \ - php8-mbstring \ - php8-mysqli \ - php8-openssl \ - php8-pdo \ - php8-pdo_dblib \ - php8-pdo_mysql \ - php8-pecl-apcu \ - php8-pecl-mcrypt \ - php8-pecl-memcached \ - php8-phar \ - php8-soap \ - php8-xmlreader \ - php8-zip \ - unzip && \ + php81-bcmath \ + php81-bz2 \ + php81-cli \ + php81-ctype \ + php81-curl \ + php81-dom \ + php81-fileinfo \ + php81-gd \ + php81-gettext \ + php81-gmp \ + php81-iconv \ + php81-json \ + php81-mbstring \ + php81-mysqli \ + php81-openssl \ + php81-pdo \ + php81-pdo_dblib \ + php81-pdo_mysql \ + php81-pecl-apcu \ + php81-pecl-memcached \ + php81-phar \ + php81-soap \ + php81-xmlreader \ + php81-zip && \ apk add --no-cache \ --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ - php8-pecl-xmlrpc && \ + php81-pecl-mcrypt \ + php81-pecl-xmlrpc && \ echo "**** install projectsend ****" && \ mkdir -p /app/www/public && \ if [ -z ${PROJECTSEND_VERSION+x} ]; then \ - PROJECTSEND_VERSION=$(curl -sX GET "https://api.github.com/repos/projectsend/projectsend/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ + PROJECTSEND_VERSION=$(curl -s https://api.github.com/repos/projectsend/projectsend/releases/latest | jq -r '. | .tag_name'); \ fi && \ - curl -s -o \ + curl -fso \ /tmp/projectsend.zip -L \ - "https://github.com/projectsend/projectsend/releases/download/${PROJECTSEND_VERSION}/projectsend-${PROJECTSEND_VERSION}.zip" && \ + "https://github.com/projectsend/projectsend/releases/download/${PROJECTSEND_VERSION}/projectsend-${PROJECTSEND_VERSION}.zip" || \ + curl -fso \ + /tmp/projectsend.zip -L \ + "https://github.com/projectsend/projectsend/releases/download/${PROJECTSEND_VERSION}/projectsend.zip" && \ unzip \ /tmp/projectsend.zip -d \ /app/www/public && \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index dd9449c..83435f1 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,4 +1,6 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.15 +# syntax=docker/dockerfile:1 + +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.17 # set version label ARG BUILD_DATE @@ -10,45 +12,45 @@ LABEL maintainer="TheSpad" RUN \ echo "**** install runtime packages ****" && \ apk add -U --upgrade --no-cache \ - curl \ - php8-bcmath \ - php8-bz2 \ - php8-cli \ - php8-ctype \ - php8-curl \ - php8-dom \ - php8-fileinfo \ - php8-gd \ - php8-gettext \ - php8-gmp \ - php8-iconv \ - php8-json \ - php8-mbstring \ - php8-mysqli \ - php8-openssl \ - php8-pdo \ - php8-pdo_dblib \ - php8-pdo_mysql \ - php8-pecl-apcu \ - php8-pecl-mcrypt \ - php8-pecl-memcached \ - php8-phar \ - php8-soap \ - php8-xmlreader \ - php8-zip \ - unzip && \ + php81-bcmath \ + php81-bz2 \ + php81-cli \ + php81-ctype \ + php81-curl \ + php81-dom \ + php81-fileinfo \ + php81-gd \ + php81-gettext \ + php81-gmp \ + php81-iconv \ + php81-json \ + php81-mbstring \ + php81-mysqli \ + php81-openssl \ + php81-pdo \ + php81-pdo_dblib \ + php81-pdo_mysql \ + php81-pecl-apcu \ + php81-pecl-memcached \ + php81-phar \ + php81-soap \ + php81-xmlreader \ + php81-zip && \ apk add --no-cache \ --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ - php8-pecl-xmlrpc && \ + php81-pecl-mcrypt \ + php81-pecl-xmlrpc && \ echo "**** install projectsend ****" && \ mkdir -p /app/www/public && \ if [ -z ${PROJECTSEND_VERSION+x} ]; then \ - PROJECTSEND_VERSION=$(curl -sX GET "https://api.github.com/repos/projectsend/projectsend/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ + PROJECTSEND_VERSION=$(curl -s https://api.github.com/repos/projectsend/projectsend/releases/latest | jq -r '. | .tag_name'); \ fi && \ - curl -s -o \ + curl -fso \ /tmp/projectsend.zip -L \ - "https://github.com/projectsend/projectsend/releases/download/${PROJECTSEND_VERSION}/projectsend-${PROJECTSEND_VERSION}.zip" && \ + "https://github.com/projectsend/projectsend/releases/download/${PROJECTSEND_VERSION}/projectsend-${PROJECTSEND_VERSION}.zip" || \ + curl -fso \ + /tmp/projectsend.zip -L \ + "https://github.com/projectsend/projectsend/releases/download/${PROJECTSEND_VERSION}/projectsend.zip" && \ unzip \ /tmp/projectsend.zip -d \ /app/www/public && \ diff --git a/README.md b/README.md index 872d695..4dd96b3 100644 --- a/README.md +++ b/README.md @@ -234,6 +234,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **08.03.23:** - Rebasing to alpine 3.17 and upgrading to s6v3. * **23.08.22:** - Add translation support * **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)). * **24.06.21:** - Rebasing to alpine 3.14, switch to nginx diff --git a/readme-vars.yml b/readme-vars.yml index e9b7f4b..bfc17f3 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -56,6 +56,7 @@ app_setup_block: | # changelog changelogs: + - { date: "08.03.23:", desc: "Rebasing to alpine 3.17 and upgrading to s6v3." } - { date: "23.08.22:", desc: "Add translation support"} - { 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: "24.06.21:", desc: "Rebasing to alpine 3.14, switch to nginx"} diff --git a/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-projectsend-config b/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-projectsend-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/init-projectsend-config/dependencies.d/init-nginx-end b/root/etc/s6-overlay/s6-rc.d/init-projectsend-config/dependencies.d/init-nginx-end new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/cont-init.d/30-config b/root/etc/s6-overlay/s6-rc.d/init-projectsend-config/run old mode 100644 new mode 100755 similarity index 53% rename from root/etc/cont-init.d/30-config rename to root/etc/s6-overlay/s6-rc.d/init-projectsend-config/run index 47700e7..8298c66 --- a/root/etc/cont-init.d/30-config +++ b/root/etc/s6-overlay/s6-rc.d/init-projectsend-config/run @@ -1,9 +1,10 @@ #!/usr/bin/with-contenv bash +# shellcheck shell=bash -if [ -d /app/www/public-tmp ]; then +if [[ -d /app/www/public-tmp ]]; then echo "New container detected. Setting up app folder and fixing permissions." mv /app/www/public-tmp /app/www/public - chown -R abc:abc /app + lsiown -R abc:abc /app fi # set default values for variables @@ -24,7 +25,7 @@ sed -i \ -e "s#;*max_file_uploads =.*#max_file_uploads = ${PHP_MAX_FILE_UPLOAD}#i" \ -e "s#;*post_max_size =.*#post_max_size = ${USABLE_MAX_UPLOAD}M#i" \ -e "s#;*cgi.fix_pathinfo=.*#cgi.fix_pathinfo= 0#i" \ - /etc/php8/php.ini + /etc/php81/php.ini # copy config PREV_DIR=$(pwd) @@ -32,13 +33,12 @@ PREV_DIR=$(pwd) cd /defaults/upload || exit 1 shopt -s globstar nullglob shopt -s dotglob - for i in * - do - if [ ! -e "/data/projectsend/${i}" ] ; then +for i in *; do + if [ ! -e "/data/projectsend/${i}" ]; then cp -R "${i}" "/data/projectsend/${i}" - chown abc:abc "/data/projectsend/${i}" - fi - done + lsiown abc:abc "/data/projectsend/${i}" + fi +done shopt -u globstar nullglob shopt -u dotglob @@ -64,47 +64,56 @@ shopt -s globstar dotglob #check if there are newer translation files in the container and if so copy them to /config if [[ -d /config/translations/lang && ! -L /app/www/public/lang ]]; then - for file in /app/www/public/lang/* - do + for file in /app/www/public/lang/*; do if [ $(date -r "$file" +%s) -ge $(date -r "/config/translations/lang/$(echo $file | awk -F '/' '{print $(NF)}')" +%s) ]; then cp "$file" /config/translations/lang/ fi done fi # symlink translations -[[ -d /config/translations/lang && ! -L /app/www/public/lang ]] && rm -rf /app/www/public/lang -[[ ! -d /config/translations/lang && ! -L /app/www/public/lang ]] && mv /app/www/public/lang /config/translations/ -[[ -d /config/translations/lang && ! -L /app/www/public/lang ]] && ln -s /config/translations/lang /app/www/public/lang +if [[ -d /config/translations/lang && ! -L /app/www/public/lang ]]; then + rm -rf /app/www/public/lang +fi +if [[ ! -d /config/translations/lang && ! -L /app/www/public/lang ]]; then + mv /app/www/public/lang /config/translations/ +fi +if [[ -d /config/translations/lang && ! -L /app/www/public/lang ]]; then + ln -s /config/translations/lang /app/www/public/lang +fi -symlinks=( \ -/app/www/public/templates/default/lang \ -/app/www/public/templates/gallery/lang \ -/app/www/public/templates/pinboxes/lang \ +symlinks=( + /app/www/public/templates/default/lang + /app/www/public/templates/gallery/lang + /app/www/public/templates/pinboxes/lang ) for i in "${symlinks[@]}"; do -path=$(echo "$i" | awk -F '/' '{print $(NF-1)"/"$NF}') -#check if there are newer translation files in the container and if so copy them to /config -if [[ -d /config/translations/"$path" && ! -L "$i" ]]; then - for file in "$i"/* - do - if [ $(date -r "$file" +%s) -ge $(date -r "/config/translations/$(echo $i | awk -F '/' '{print $(NF-1)}')/$(echo $file | awk -F '/' '{print $(NF)}')" +%s) ]; then - cp "$file" "/config/translations/$(echo $i | awk -F '/' '{print $(NF-1)}')" + path=$(echo "$i" | awk -F '/' '{print $(NF-1)"/"$NF}') + #check if there are newer translation files in the container and if so copy them to /config + if [[ -d /config/translations/"$path" && ! -L "$i" ]]; then + for file in "$i"/*; do + if [ $(date -r "$file" +%s) -ge $(date -r "/config/translations/$(echo $i | awk -F '/' '{print $(NF-1)}')/$(echo $file | awk -F '/' '{print $(NF)}')" +%s) ]; then + cp "$file" "/config/translations/$(echo $i | awk -F '/' '{print $(NF-1)}')" + fi + done + fi + # symlink translations + if [[ -d /config/translations/"$path" && ! -L "$i" ]]; then + rm -rf "$i" + fi + if [[ ! -d /config/translations/"$path" && ! -L "$i" ]]; then + mv "$i" /config/translations/"$(echo $i | awk -F '/' '{print $(NF-1)}')" + fi + if [[ -d /config/translations/"$path" && ! -L "$i" ]]; then + ln -s /config/translations/"$path" "$i" fi -done -fi -# symlink translations -[[ -d /config/translations/"$path" && ! -L "$i" ]] && rm -rf "$i" -[[ ! -d /config/translations/"$path" && ! -L "$i" ]] && mv "$i" /config/translations/"$(echo $i | awk -F '/' '{print $(NF-1)}')" -[[ -d /config/translations/"$path" && ! -L "$i" ]] && ln -s /config/translations/"$path" "$i" done shopt -u globstar dotglob # permissions -echo "Fixing app data permissions." -chown abc:abc \ - /data/projectsend -chown -R abc:abc \ +lsiown -R abc:abc \ /config +lsiown abc:abc \ + /data/projectsend diff --git a/root/etc/s6-overlay/s6-rc.d/init-projectsend-config/type b/root/etc/s6-overlay/s6-rc.d/init-projectsend-config/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-projectsend-config/type @@ -0,0 +1 @@ +oneshot diff --git a/root/etc/s6-overlay/s6-rc.d/init-projectsend-config/up b/root/etc/s6-overlay/s6-rc.d/init-projectsend-config/up new file mode 100644 index 0000000..1183f28 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-projectsend-config/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-projectsend-config/run diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-projectsend-config b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-projectsend-config new file mode 100644 index 0000000..e69de29 diff --git a/root/migrations/02-default-location b/root/migrations/02-default-location index 4b2195f..d9b149f 100644 --- a/root/migrations/02-default-location +++ b/root/migrations/02-default-location @@ -1,10 +1,11 @@ #!/usr/bin/with-contenv bash +# shellcheck shell=bash DEFAULT_CONF="/config/nginx/site-confs/default.conf" OLD_ROOT="root /app/projectsend;" NEW_ROOT="root /app/www/public;" -if grep -q "${OLD_ROOT}" "${DEFAULT_CONF}";then +if [[ -f "${DEFAULT_CONF}" ]] && grep -q "${OLD_ROOT}" "${DEFAULT_CONF}"; then echo "updating root in ${DEFAULT_CONF}" sed -i "s|${OLD_ROOT}|${NEW_ROOT}|" "${DEFAULT_CONF}" fi