This commit is contained in:
Jean-Christian Denis 2024-12-14 23:15:00 +01:00
parent 21761aff3a
commit 70c616fa8e
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
2 changed files with 57 additions and 61 deletions

View file

@ -5,24 +5,35 @@
# Alpine # Alpine
## ##
# Use latest Alpine docker release # Use fix Alpine docker release
FROM alpine:3.21.0 FROM alpine:3.21.0
# Select Dotclear release canal (stable | unstable)
ARG CANAL stable
# Set environment variables
ENV DC_DOCKER_CANAL=$CANAL \
DC_DOCKER_PHP=php84 \
DC_DOCKER_PLUGIN_DOCLEARWATCH=0.9.3 \
DC_DOCKER_PLUGIN_DCLOG=1.7.3 \
DC_DOCKER_PLUGIN_SYSINFO=10.3 \
DC_RC_PATH=/var/www/dotclear/config.php \
DC_PLUGINS_ROOT=/var/www/dotclear/plugins \
DC_TPL_CACHE=/var/www/dotclear/cache \
DC_VAR=/var/www/dotclear/var
# Image label
LABEL "org.opencontainers.image.authors"="Jean-Christian Paul Denis" \
"org.opencontainers.image.source"="https://github.com/JcDenis/docker-dotclear" \
"org.opencontainers.image.description"="Dotclear docker image $DC_DOCKER_CANAL" \
"org.opencontainers.image.licenses"="AGPL-3.0"
# Set system timezone # Set system timezone
RUN echo "UTC" > /etc/timezone RUN echo "UTC" > /etc/timezone
# Select Dotclear release canal (stable | unstable)
ARG CANAL stable
ENV CNL_DOTCLEAR=$CANAL
# Create user # Create user
RUN adduser -D -g 'www' www RUN adduser -D -g 'www' www
# Image label
LABEL "org.opencontainers.image.authors"="Jean-Christian Paul Denis"
LABEL "org.opencontainers.image.source"="https://github.com/JcDenis/docker-dotclear"
LABEL "org.opencontainers.image.description"="Dotclear docker image $CNL_DOTCLEAR"
LABEL "org.opencontainers.image.licenses"="AGPL-3.0"
## ##
# Nginx # Nginx
@ -35,7 +46,6 @@ RUN apk add --no-cache --update \
tar \ tar \
unzip \ unzip \
libxml2-utils libxml2-utils
#xq
# Create directories structure # Create directories structure
RUN mkdir -p /var/www/dotclear \ RUN mkdir -p /var/www/dotclear \
@ -50,46 +60,44 @@ COPY etc/snippets_common.conf /etc/nginx/snippets/snippets_common.conf
# Fix vuln alpine 3.21.0 : curl 8.11.0-r2 => 8.11-r0 # Fix vuln alpine 3.21.0 : curl 8.11.0-r2 => 8.11-r0
RUN apk upgrade curl RUN apk upgrade curl
## ##
# PHP # PHP
## ##
# Try to bypass Alpine Linux iconv bug # Try to bypass Alpine Linux iconv bug
#RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ gnu-libiconv
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.12/community/ gnu-libiconv=1.15-r2 RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.12/community/ gnu-libiconv=1.15-r2
ENV LD_PRELOAD=/usr/lib/preloadable_libiconv.so ENV LD_PRELOAD=/usr/lib/preloadable_libiconv.so
# Use PHP 8.4 release
ENV VER_PHP=php84
# Install PHP required packages # Install PHP required packages
RUN apk add --no-cache --update \ RUN apk add --no-cache --update \
${VER_PHP}-common \ ${DC_DOCKER_PHP}-common \
${VER_PHP}-cli \ ${DC_DOCKER_PHP}-cli \
${VER_PHP}-fpm \ ${DC_DOCKER_PHP}-fpm \
${VER_PHP}-session \ ${DC_DOCKER_PHP}-session \
${VER_PHP}-curl \ ${DC_DOCKER_PHP}-curl \
${VER_PHP}-gd \ ${DC_DOCKER_PHP}-gd \
${VER_PHP}-gmp \ ${DC_DOCKER_PHP}-gmp \
${VER_PHP}-exif \ ${DC_DOCKER_PHP}-exif \
${VER_PHP}-tidy \ ${DC_DOCKER_PHP}-tidy \
${VER_PHP}-intl \ ${DC_DOCKER_PHP}-intl \
${VER_PHP}-json \ ${DC_DOCKER_PHP}-json \
${VER_PHP}-mbstring \ ${DC_DOCKER_PHP}-mbstring \
${VER_PHP}-iconv \ ${DC_DOCKER_PHP}-iconv \
${VER_PHP}-gettext \ ${DC_DOCKER_PHP}-gettext \
${VER_PHP}-mysqli \ ${DC_DOCKER_PHP}-mysqli \
${VER_PHP}-pgsql \ ${DC_DOCKER_PHP}-pgsql \
${VER_PHP}-opcache \ ${DC_DOCKER_PHP}-opcache \
${VER_PHP}-dom \ ${DC_DOCKER_PHP}-dom \
${VER_PHP}-xml \ ${DC_DOCKER_PHP}-xml \
${VER_PHP}-simplexml \ ${DC_DOCKER_PHP}-simplexml \
${VER_PHP}-zip \ ${DC_DOCKER_PHP}-zip \
${VER_PHP}-pdo_sqlite ${DC_DOCKER_PHP}-pdo_sqlite
# Copy PHP configuration # Copy PHP configuration
COPY etc/${CNL_DOTCLEAR}-php.ini /etc/${VER_PHP}/php.ini COPY etc/${DC_DOCKER_CANAL}-php.ini /etc/${DC_DOCKER_PHP}/php.ini
COPY etc/php-fpm.conf /etc/${VER_PHP}/php-fpm.d/www.conf COPY etc/php-fpm.conf /etc/${DC_DOCKER_PHP}/php-fpm.d/www.conf
## ##
# Dotclear # Dotclear
@ -97,8 +105,8 @@ COPY etc/php-fpm.conf /etc/${VER_PHP}/php-fpm.d/www.conf
# Download latest Dotclear version # Download latest Dotclear version
RUN curl -fsSL -o versions.xml "http://download.dotclear.org/versions.xml" \ RUN curl -fsSL -o versions.xml "http://download.dotclear.org/versions.xml" \
&& curl -fsSL -o dotclear.zip $(xmllint --xpath "//release[@name='$CNL_DOTCLEAR']/@href" versions.xml | awk -F'[="]' '!/>/{print $(NF-1)}') \ && curl -fsSL -o dotclear.zip $(xmllint --xpath "//release[@name='$DC_DOCKER_CANAL']/@href" versions.xml | awk -F'[="]' '!/>/{print $(NF-1)}') \
&& echo "$(xmllint --xpath "//release[@name='$CNL_DOTCLEAR']/@checksum" versions.xml | awk -F'[="]' '!/>/{print $(NF-1)}') dotclear.zip" | md5sum -c - \ && echo "$(xmllint --xpath "//release[@name='$DC_DOCKER_CANAL']/@checksum" versions.xml | awk -F'[="]' '!/>/{print $(NF-1)}') dotclear.zip" | md5sum -c - \
&& mkdir -p /usr/src/dotclear \ && mkdir -p /usr/src/dotclear \
&& unzip -d /usr/src dotclear.zip \ && unzip -d /usr/src dotclear.zip \
&& rm dotclear.zip && rm dotclear.zip
@ -106,48 +114,36 @@ RUN curl -fsSL -o versions.xml "http://download.dotclear.org/versions.xml" \
# Create predefined www structure # Create predefined www structure
COPY www /var/lib/dotclear COPY www /var/lib/dotclear
# These variables are only used for first install, see inc/config.php, from dotclear 2.32
# Custom path for dotclear config file
ENV DC_RC_PATH=/var/www/dotclear/config.php
# Directory of third party plugins
ENV DC_PLUGINS_ROOT=/var/www/dotclear/plugins
# Directory for template cache files
ENV DC_TPL_CACHE=/var/www/dotclear/cache
# Directory for dotclear var
ENV DC_VAR=/var/www/dotclear/var
## ##
# Plugins # Plugins
## ##
# DotclearWatch # DotclearWatch
ENV VER_PLUGIN_DW=0.9.3 RUN curl -fsSL -o plugin.zip "https://github.com/JcDenis/DotclearWatch/releases/download/v$DC_DOCKER_PLUGIN_DOCLEARWATCH/plugin-DotclearWatch.zip" \
RUN curl -fsSL -o plugin.zip "https://github.com/JcDenis/DotclearWatch/releases/download/v$VER_PLUGIN_DW/plugin-DotclearWatch.zip" \
&& mkdir -p /var/lib/dotclear/plugins/DotclearWatch \ && mkdir -p /var/lib/dotclear/plugins/DotclearWatch \
&& unzip -d /var/lib/dotclear/plugins plugin.zip \ && unzip -d /var/lib/dotclear/plugins plugin.zip \
&& rm plugin.zip && rm plugin.zip
# dcLog # dcLog
ENV VER_PLUGIN_DL=1.7.3 RUN curl -fsSL -o plugin.zip "https://github.com/JcDenis/dcLog/releases/download/v$DC_DOCKER_PLUGIN_DCLOG/plugin-dcLog.zip" \
RUN curl -fsSL -o plugin.zip "https://github.com/JcDenis/dcLog/releases/download/v$VER_PLUGIN_DL/plugin-dcLog.zip" \
&& mkdir -p /var/lib/dotclear/plugins/dcLog \ && mkdir -p /var/lib/dotclear/plugins/dcLog \
&& unzip -d /var/lib/dotclear/plugins plugin.zip \ && unzip -d /var/lib/dotclear/plugins plugin.zip \
&& rm plugin.zip && rm plugin.zip
# sysInfo # sysInfo
ENV VER_PLUGIN_SI=10.3 RUN curl -fsSL -o plugin.zip "https://github.com/franck-paul/sysInfo/releases/download/$DC_DOCKER_PLUGIN_SYSINFO/plugin-sysInfo-$DC_DOCKER_PLUGIN_SYSINFO.zip" \
RUN curl -fsSL -o plugin.zip "https://github.com/franck-paul/sysInfo/releases/download/$VER_PLUGIN_SI/plugin-sysInfo-$VER_PLUGIN_SI.zip" \
&& mkdir -p /var/lib/dotclear/plugins/sysInfo \ && mkdir -p /var/lib/dotclear/plugins/sysInfo \
&& unzip -d /var/lib/dotclear/plugins plugin.zip \ && unzip -d /var/lib/dotclear/plugins plugin.zip \
&& rm plugin.zip && rm plugin.zip
# Fix ownership
RUN chown -R www:www /var/lib/dotclear /usr/src/dotclear
## ##
# END # END
## ##
# Fix ownership
RUN chown -R www:www /var/lib/dotclear /usr/src/dotclear
# Docker container uses port 80 # Docker container uses port 80
EXPOSE 80 EXPOSE 80

View file

@ -6,7 +6,7 @@
set -e set -e
# Read image version # Read image version
if [ "$CNL_DOTCLEAR" == "stable" ]; then if [ "$DC_DOCKER_CANAL" == "stable" ]; then
# stable = x.xx.x => x.xx.x # stable = x.xx.x => x.xx.x
export COMPARE_HAYSTACK="s/^\s*\"release_version\":\s*\"\(.*\)\",/\1/p" export COMPARE_HAYSTACK="s/^\s*\"release_version\":\s*\"\(.*\)\",/\1/p"
else else
@ -65,7 +65,7 @@ echo >&2 "Updating Dotclear common themes..."
cp -rf /var/www/dotclear/app/themes/* /var/www/dotclear/themes cp -rf /var/www/dotclear/app/themes/* /var/www/dotclear/themes
# DEBUG mode for non stable releases # DEBUG mode for non stable releases
if [ "$CNL_DOTCLEAR" == "stable" ]; then if [ "$DC_DOCKER_CANAL" == "stable" ]; then
echo >&2 "Disabling Dotclear DEBUG mode" echo >&2 "Disabling Dotclear DEBUG mode"
sed -i -e "s/ \/\/\*== DC_DEBUG ==/ \/\*== DC_DEBUG ==/g" /var/www/dotclear/app/src/Config.php sed -i -e "s/ \/\/\*== DC_DEBUG ==/ \/\*== DC_DEBUG ==/g" /var/www/dotclear/app/src/Config.php
else else