Переглянути джерело

Docker uniform timezone behaviour (#4905)

* Docker Alpine timezone for :newest and :oldest
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/4903
Forgot the development images Newest and Oldest

* Uniform timezone behaviour

* shellcheck

* A bit more documentation
Alexandre Alapetite 3 роки тому
батько
коміт
543fa4e76c

+ 1 - 2
.devcontainer/Dockerfile

@@ -2,10 +2,9 @@ FROM alpine:3.17
 
 ENV TZ UTC
 SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
-RUN apk add --no-cache tzdata && \
-	ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 
 RUN apk add --no-cache \
+	tzdata \
 	apache2 php-apache2 \
 	php php-curl php-gmp php-intl php-mbstring php-xml php-zip \
 	php-ctype php-dom php-fileinfo php-iconv php-json php-opcache php-openssl php-phar php-session php-simplexml php-xmlreader php-xmlwriter php-xml php-tokenizer php-zlib \

+ 1 - 1
Docker/Dockerfile

@@ -2,8 +2,8 @@ FROM debian:11-slim
 
 ENV TZ UTC
 SHELL ["/bin/bash", "-o", "pipefail", "-c"]
-RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 
+ARG DEBIAN_FRONTEND=noninteractive
 RUN apt-get update && \
 	apt-get install --no-install-recommends -y \
 	ca-certificates cron \

+ 1 - 2
Docker/Dockerfile-Alpine

@@ -2,10 +2,9 @@ FROM alpine:3.17
 
 ENV TZ UTC
 SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
-RUN apk add --no-cache tzdata && \
-	ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 
 RUN apk add --no-cache \
+	tzdata \
 	apache2 php-apache2 \
 	php php-curl php-gmp php-intl php-mbstring php-xml php-zip \
 	php-ctype php-dom php-fileinfo php-iconv php-json php-opcache php-openssl php-phar php-session php-simplexml php-xmlreader php-xmlwriter php-xml php-tokenizer php-zlib \

+ 2 - 0
Docker/Dockerfile-Oldest

@@ -2,7 +2,9 @@ FROM alpine:3.8
 
 ENV TZ UTC
 SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
+
 RUN apk add --no-cache \
+	tzdata \
 	apache2 php7-apache2 \
 	php7 php7-curl php7-gmp php7-intl php7-mbstring php7-xml php7-zip \
 	php7-ctype php7-dom php7-iconv php7-json php7-opcache php7-openssl php7-phar php7-session php7-xmlreader php7-xml php7-zlib \

+ 1 - 1
Docker/Dockerfile-QEMU-ARM

@@ -8,8 +8,8 @@ COPY ./Docker/qemu-arm-* /usr/bin/
 
 ENV TZ UTC
 SHELL ["/bin/bash", "-o", "pipefail", "-c"]
-RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 
+ARG DEBIAN_FRONTEND=noninteractive
 RUN apt-get update && \
 	apt-get install --no-install-recommends -y \
 	ca-certificates cron \

+ 5 - 1
Docker/README.md

@@ -81,7 +81,7 @@ and with newer packages in general (Apache, PHP).
 
 ## Environment variables
 
-* `TZ`: (default is `UTC`) A [server timezone](http://php.net/timezones) (default is `UTC`)
+* `TZ`: (default is `UTC`) A [server timezone](http://php.net/timezones)
 * `CRON_MIN`: (default is disabled) Define minutes for the built-in cron job to automatically refresh feeds (see below for more advanced options)
 * `FRESHRSS_ENV`: (default is `production`) Enables additional development information if set to `development` (increases the level of logging and ensures that errors are displayed) (see below for more development options)
 * `COPY_LOG_TO_SYSLOG`: (default is `On`) Copy all the logs to syslog
@@ -303,6 +303,7 @@ services:
       options:
         max-size: 10m
     volumes:
+      # Recommended volume for FreshRSS persistent data such as configuration and SQLite databases
       - data:/var/www/FreshRSS/data
       # Optional volume for storing third-party extensions
       - extensions:/var/www/FreshRSS/extensions
@@ -314,8 +315,11 @@ services:
       # If you want to open a port 8080 on the local machine:
       - "8080:80"
     environment:
+      # A timezone http://php.net/timezones (default is UTC)
       TZ: Europe/Paris
+      # Cron job to refresh feeds at specified minutes
       CRON_MIN: '2,32'
+      # 'development' for additional logs; default is 'production'
       FRESHRSS_ENV: development
       # Optional advanced parameter controlling the internal Apache listening port
       LISTEN: 0.0.0.0:80

+ 4 - 1
Docker/entrypoint.sh

@@ -1,11 +1,14 @@
 #!/bin/sh
 
-php -f ./cli/prepare.php >/dev/null
+ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime
+echo "$TZ" >/etc/timezone
 
 find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?date.timezone#s#^.*#date.timezone = $TZ#" {} \;
 find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?post_max_size#s#^.*#post_max_size = 32M#" {} \;
 find /etc/php*/ -type f -name php.ini -exec sed -r -i "\\#^;?upload_max_filesize#s#^.*#upload_max_filesize = 32M#" {} \;
 
+php -f ./cli/prepare.php >/dev/null
+
 if [ -n "$LISTEN" ]; then
 	find /etc/apache2/ -type f -name FreshRSS.Apache.conf -exec sed -r -i "\\#^Listen#s#^.*#Listen $LISTEN#" {} \;
 fi