diff --git a/Dockerfile b/Dockerfile index 2d7906b..8701551 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,19 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.15 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.16 # set version label ARG BUILD_DATE ARG VERSION ARG PIWIGO_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -LABEL maintainer="sparklyballs" +LABEL maintainer="thespad" RUN \ echo "**** install packages ****" && \ apk add --no-cache --upgrade \ - curl \ exiftool \ ffmpeg \ imagemagick \ libjpeg-turbo-utils \ - lynx \ mediainfo \ php8-apcu \ php8-cgi \ @@ -32,9 +30,7 @@ RUN \ php8-xsl \ php8-zip \ poppler-utils \ - re2c \ - unzip \ - wget && \ + re2c && \ apk add --no-cache \ --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ php8-pecl-xmlrpc && \ @@ -43,18 +39,23 @@ RUN \ PIWIGO_RELEASE=$(curl -sX GET "https://api.github.com/repos/Piwigo/Piwigo/releases/latest" \ | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ - mkdir /piwigo && \ + mkdir -p /app/www/public && \ curl -o \ - /piwigo/piwigo.zip -L \ + /tmp/piwigo.zip -L \ "https://piwigo.org/download/dlcounter.php?code=${PIWIGO_RELEASE}" && \ + unzip -q /tmp/piwigo.zip -d /tmp && \ + mv /tmp/piwigo/* /app/www/public && \ # The max filesize is 2M by default, which is way to small for most photos sed -ri 's/^upload_max_filesize = .*/upload_max_filesize = 100M/' /etc/php8/php.ini && \ # The max post size is 8M by default, it must be at least max_filesize - sed -ri 's/^post_max_size = .*/post_max_size = 100M/' /etc/php8/php.ini + sed -ri 's/^post_max_size = .*/post_max_size = 100M/' /etc/php8/php.ini && \ + echo "**** cleanup ****" && \ + rm -rf \ + /tmp/* # copy local files COPY root/ / # ports and volumes EXPOSE 80 443 -VOLUME /config +VOLUME /config /gallery diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index f008f5b..6e30d2c 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,21 +1,19 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.15 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.16 # set version label ARG BUILD_DATE ARG VERSION ARG PIWIGO_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -LABEL maintainer="sparklyballs" +LABEL maintainer="thespad" RUN \ echo "**** install packages ****" && \ apk add --no-cache --upgrade \ - curl \ exiftool \ ffmpeg \ imagemagick \ libjpeg-turbo-utils \ - lynx \ mediainfo \ php8-apcu \ php8-cgi \ @@ -32,9 +30,7 @@ RUN \ php8-xsl \ php8-zip \ poppler-utils \ - re2c \ - unzip \ - wget && \ + re2c && \ apk add --no-cache \ --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ php8-pecl-xmlrpc && \ @@ -43,18 +39,23 @@ RUN \ PIWIGO_RELEASE=$(curl -sX GET "https://api.github.com/repos/Piwigo/Piwigo/releases/latest" \ | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ - mkdir /piwigo && \ + mkdir -p /app/www/public && \ curl -o \ - /piwigo/piwigo.zip -L \ + /tmp/piwigo.zip -L \ "https://piwigo.org/download/dlcounter.php?code=${PIWIGO_RELEASE}" && \ + unzip -q /tmp/piwigo.zip -d /tmp && \ + mv /tmp/piwigo/* /app/www/public && \ # The max filesize is 2M by default, which is way to small for most photos sed -ri 's/^upload_max_filesize = .*/upload_max_filesize = 100M/' /etc/php8/php.ini && \ # The max post size is 8M by default, it must be at least max_filesize - sed -ri 's/^post_max_size = .*/post_max_size = 100M/' /etc/php8/php.ini + sed -ri 's/^post_max_size = .*/post_max_size = 100M/' /etc/php8/php.ini && \ + echo "**** cleanup ****" && \ + rm -rf \ + /tmp/* # copy local files COPY root/ / # ports and volumes EXPOSE 80 443 -VOLUME /config +VOLUME /config /gallery diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 26fd428..b011965 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,21 +1,19 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.15 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.16 # set version label ARG BUILD_DATE ARG VERSION ARG PIWIGO_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -LABEL maintainer="sparklyballs" +LABEL maintainer="thespad" RUN \ echo "**** install packages ****" && \ apk add --no-cache --upgrade \ - curl \ exiftool \ ffmpeg \ imagemagick \ libjpeg-turbo-utils \ - lynx \ mediainfo \ php8-apcu \ php8-cgi \ @@ -32,29 +30,32 @@ RUN \ php8-xsl \ php8-zip \ poppler-utils \ - re2c \ - unzip \ - wget && \ + re2c && \ apk add --no-cache \ --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ php8-pecl-xmlrpc && \ echo "**** download piwigo ****" && \ if [ -z ${PIWIGO_RELEASE+x} ]; then \ - PIWIGO_RELEASE=$(curl -sX GET "https://api.github.com/repos/Piwigo/Piwigo/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ + PIWIGO_RELEASE=$(curl -sX GET "https://api.github.com/repos/Piwigo/Piwigo/releases/latest" \ + | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ - mkdir /piwigo && \ + mkdir -p /app/www/public && \ curl -o \ - /piwigo/piwigo.zip -L \ + /tmp/piwigo.zip -L \ "https://piwigo.org/download/dlcounter.php?code=${PIWIGO_RELEASE}" && \ + unzip -q /tmp/piwigo.zip -d /tmp && \ + mv /tmp/piwigo/* /app/www/public && \ # The max filesize is 2M by default, which is way to small for most photos sed -ri 's/^upload_max_filesize = .*/upload_max_filesize = 100M/' /etc/php8/php.ini && \ # The max post size is 8M by default, it must be at least max_filesize - sed -ri 's/^post_max_size = .*/post_max_size = 100M/' /etc/php8/php.ini + sed -ri 's/^post_max_size = .*/post_max_size = 100M/' /etc/php8/php.ini && \ + echo "**** cleanup ****" && \ + rm -rf \ + /tmp/* # copy local files COPY root/ / # ports and volumes EXPOSE 80 443 -VOLUME /config +VOLUME /config /gallery diff --git a/README.md b/README.md index ab25696..cf86572 100644 --- a/README.md +++ b/README.md @@ -60,12 +60,11 @@ The architectures supported by this image are: ## Application Setup -Docker image update and recreation of container alone won't update Piwigo version. In order to update Piwigo version, firstly make sure you are using the latest docker image, then go to Admin->Tools->Updates and use the app updater. -* You must create a user and database for piwigo to use in a mysql/mariadb server. -* In the setup page for database, use the ip address rather than hostname. -* A basic nginx configuration file can be found in `/config/nginx/site-confs`, edit the file to enable ssl (port 443 by default), set servername etc. +* You must create a user and database for piwigo to use in a mysql/mariadb server. + * Self-signed keys are generated the first time you run the container and can be found in `/config/keys`, if needed, you can replace them with your own. -* The easiest way to edit the configuration file is to enable local files editor from the plugins page and use it to configure email settings etc. + +* The easiest way to edit the configuration file is to enable local files editor from the plugins page and use it to configure email settings etc." ## Usage @@ -85,8 +84,8 @@ services: - PGID=1000 - TZ=Europe/London volumes: - - :/config - - :/gallery + - /path/to/appdata/config:/config + - /path/to/appdata/gallery:/gallery ports: - 80:80 restart: unless-stopped @@ -101,8 +100,8 @@ docker run -d \ -e PGID=1000 \ -e TZ=Europe/London \ -p 80:80 \ - -v :/config \ - -v :/gallery \ + -v /path/to/appdata/config:/config \ + -v /path/to/appdata/gallery:/gallery \ --restart unless-stopped \ lscr.io/linuxserver/piwigo:latest ``` @@ -118,7 +117,7 @@ Container images are configured using parameters passed at runtime (such as thos | `-e PGID=1000` | for GroupID - see below for explanation | | `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London. | | `-v /config` | Configuration files. | -| `-v /gallery` | Image, plugin, & theme storage for Piwigo | +| `-v /gallery` | Image storage for Piwigo | ## Environment variables from files (Docker secrets) @@ -229,6 +228,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **08.11.22:** - Rebase to Alpine 3.16, migrate to s6v3. Move application install to /app/www/public, add migration for existing users. Container updates should now update the application correctly. * **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)). * **29.06.21:** - Rebase to 3.14, Add php7-zip package * **20.05.21:** - Create separate volume for image data diff --git a/readme-vars.yml b/readme-vars.yml index e78c179..0fac460 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -21,31 +21,24 @@ param_env_vars: - { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London." } param_usage_include_vols: true param_volumes: - - { vol_path: "/config", vol_host_path: "", desc: "Configuration files." } - - { vol_path: "/gallery", vol_host_path: "", desc: "Image, plugin, & theme storage for Piwigo" } + - { vol_path: "/config", vol_host_path: "/path/to/appdata/config", desc: "Configuration files." } + - { vol_path: "/gallery", vol_host_path: "/path/to/appdata/gallery", desc: "Image storage for Piwigo" } param_usage_include_ports: true param_ports: - { external_port: "80", internal_port: "80", port_desc: "Application WebUI" } # application setup block app_setup_block_enabled: true -app_setup_block: "Docker image update and recreation of container alone won't update Piwigo version. In order to update Piwigo version, firstly make sure you are using the latest docker image, then go to Admin->Tools->Updates and use the app updater. +app_setup_block: | + * You must create a user and database for piwigo to use in a mysql/mariadb server. -* You must create a user and database for piwigo to use in a mysql/mariadb server. + * Self-signed keys are generated the first time you run the container and can be found in `/config/keys`, if needed, you can replace them with your own. -* In the setup page for database, use the ip address rather than hostname. - -* A basic nginx configuration file can be found in `/config/nginx/site-confs`, edit the file to enable ssl (port 443 by default), set servername etc. - -* Self-signed keys are generated the first time you run the container and can be found in `/config/keys`, if needed, you can replace them with your own. - -* The easiest way to edit the configuration file is to enable local files editor from the plugins page and use it to configure email settings etc." - -app_setup_nginx_reverse_proxy_snippet: false -app_setup_nginx_reverse_proxy_block: "" + * The easiest way to edit the configuration file is to enable local files editor from the plugins page and use it to configure email settings etc." # changelog changelogs: + - { date: "08.11.22:", desc: "Rebase to Alpine 3.16, migrate to s6v3. Move application install to /app/www/public, add migration for existing users. Container updates should now update the application correctly." } - { 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: "29.06.21:", desc: "Rebase to 3.14, Add php7-zip package" } - { date: "20.05.21:", desc: "Create separate volume for image data" } diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample deleted file mode 100644 index 3c045c1..0000000 --- a/root/defaults/nginx/site-confs/default.conf.sample +++ /dev/null @@ -1,34 +0,0 @@ -## Version 2022/08/20 - Changelog: https://github.com/linuxserver/docker-piwigo/commits/master/root/defaults/nginx/site-confs/default.conf.sample - -server { - listen 80 default_server; - listen [::]:80 default_server; - - listen 443 ssl http2 default_server; - listen [::]:443 ssl http2 default_server; - - server_name _; - - root /config/www/gallery; - 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$is_args$args =404; - } - - 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-install b/root/etc/cont-init.d/40-install deleted file mode 100644 index 6d7f504..0000000 --- a/root/etc/cont-init.d/40-install +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/with-contenv bash - -# make our folders -mkdir -p \ - /gallery - -# install piwigo -if [ ! -f "/config/www/gallery/index.php" ] && [ ! -f "/gallery/index.php" ]; then - unzip -q /piwigo/piwigo.zip -d /tmp - mv /tmp/piwigo/* /gallery - rm -rf /tmp/piwigo -fi - -# copy config -if [ ! -f "/config/www/gallery/local/config/config.inc.php" ] && [ ! -f "/gallery/local/config/config.inc.php" ]; then - cp /gallery/include/config_default.inc.php /gallery/local/config/config.inc.php -fi - - -if [ ! -d "/config/www/gallery" ]; then - ln -s /gallery /config/www/gallery -fi - -if [[ -d /gallery ]]; then - if [[ "$(stat -c '%U' /gallery)" != "abc" ]]; then - chown -R abc:abc /gallery - fi -fi - -# permissions -chown -R abc:abc \ - /config - diff --git a/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-piwigo-config b/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-piwigo-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/dependencies.d/init-config b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/dependencies.d/init-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run new file mode 100755 index 0000000..f2e88ad --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run @@ -0,0 +1,77 @@ +#!/usr/bin/with-contenv bash + +# make our folders +mkdir -p \ + /config/www \ + /gallery/upload \ + /gallery/galleries + +# Migrate old data +if [[ -f /gallery/index.php ]]; then + echo "*******************************************************************************" + echo "" + echo "Migrating old install..." + mv /gallery/_data/ /config/www/_data + mv /gallery/language/ /config/www/language + mv /gallery/plugins/ /config/www/plugins + mv /gallery/themes/ /config/www/themes + mv /gallery/local/ /config/www/local + rm /gallery/index.php + rm /config/www/gallery + sed -i "s|root /config/www/gallery;|root /app/www/public;|" /config/nginx/site-confs/default.conf + echo "Migration completed." + echo "" + echo "You can now safely delete everything in /gallery *except* for the upload and" + echo "galleries directories. If your photos are stored elsewhere you can ignore this." + echo "" + echo "*******************************************************************************" +fi + +shopt -s globstar dotglob + +symlinks=( \ +/app/www/public/upload \ +/app/www/public/galleries \ +) + +for i in "${symlinks[@]}"; do +if [[ -d /gallery/"$(basename "$i")" && ! -L "$i" ]]; then + rm -rf "$i" +fi +if [[ -d /gallery/"$(basename "$i")" && ! -L "$i" ]]; then + ln -s /gallery/"$(basename "$i")" "$i" +fi +done + +symlinks=( \ +/app/www/public/language \ +/app/www/public/plugins \ +/app/www/public/local \ +/app/www/public/themes \ +/app/www/public/_data \ +) + +for i in "${symlinks[@]}"; do +if [[ -d /config/www/"$(basename "$i")" && ! -L "$i" ]]; then + rm -rf "$i" +fi +if [[ ! -d /config/www/"$(basename "$i")" && ! -L "$i" ]]; then + mv "$i" /config/www/ +fi +if [[ -d /config/www/"$(basename "$i")" && ! -L "$i" ]]; then + ln -s /config/www/"$(basename "$i")" "$i" +fi +done + +shopt -u globstar dotglob + +# copy config +if [[ ! -f "/config/www/local/config/config.inc.php" ]]; then + cp /app/www/public/include/config_default.inc.php /config/www/local/config/config.inc.php +fi + +# permissions +lsiown -R abc:abc \ + /config \ + /app \ + /gallery diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/type b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/type @@ -0,0 +1 @@ +oneshot diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/up b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/up new file mode 100644 index 0000000..d252e03 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-piwigo-config/run diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-piwigo-config b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-piwigo-config new file mode 100644 index 0000000..e69de29