docker-dotclear/Dockerfile

158 lines
4.5 KiB
Text
Raw Normal View History

2024-11-24 12:55:58 +00:00
# docker-dotclear:*
# docker-dotclear Dockerfile
##
# Alpine
##
2024-12-14 22:15:00 +00:00
# Use fix Alpine docker release
2024-12-12 21:36:39 +00:00
FROM alpine:3.21.0
2024-11-24 12:55:58 +00:00
# Select Dotclear release canal (stable | unstable)
ARG CANAL stable
2024-12-14 22:15:00 +00:00
# Set environment variables
ENV DC_DOCKER_CANAL=$CANAL \
DC_DOCKER_PHP=php84 \
2024-12-26 20:08:35 +00:00
DC_DOCKER_PLUGIN_DOTCLEARWATCH=0.9.3 \
2024-12-14 22:15:00 +00:00
DC_DOCKER_PLUGIN_DCLOG=1.7.3 \
2024-12-25 09:25:05 +00:00
DC_DOCKER_PLUGIN_SYSINFO=10.4 \
2024-12-14 22:15:00 +00:00
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
RUN echo "UTC" > /etc/timezone
2024-11-24 12:55:58 +00:00
2024-12-12 23:44:41 +00:00
# Create user
RUN adduser -D -g 'www' www
2024-11-24 12:55:58 +00:00
##
# Nginx
##
# Install required package
RUN apk add --no-cache --update \
nginx \
2024-11-24 12:55:58 +00:00
curl \
tar \
2024-12-14 18:01:16 +00:00
unzip \
libxml2-utils
2024-11-24 12:55:58 +00:00
# Create directories structure
2024-12-14 18:01:16 +00:00
RUN mkdir -p /var/www/dotclear \
&& chown -R www:www /var/lib/nginx /var/www
2024-11-24 12:55:58 +00:00
# Copy nginx configuration
COPY etc/nginx.conf /etc/nginx/nginx.conf
COPY etc/snippets_subfolder.conf /etc/nginx/snippets/snippets_subfolder.conf
COPY etc/snippets_subdomain.conf /etc/nginx/snippets/snippets_subdomain.conf
COPY etc/snippets_common.conf /etc/nginx/snippets/snippets_common.conf
2024-12-14 14:03:55 +00:00
# Fix vuln alpine 3.21.0 : curl 8.11.0-r2 => 8.11-r0
RUN apk upgrade curl
2024-12-12 23:44:41 +00:00
2024-12-14 22:15:00 +00:00
2024-11-24 12:55:58 +00:00
##
# PHP
##
2024-11-24 13:05:40 +00:00
# Try to bypass Alpine Linux iconv bug
2024-11-24 13:16:11 +00:00
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.12/community/ gnu-libiconv=1.15-r2
2024-11-25 20:09:33 +00:00
ENV LD_PRELOAD=/usr/lib/preloadable_libiconv.so
2024-11-24 13:05:40 +00:00
2024-11-24 12:55:58 +00:00
# Install PHP required packages
RUN apk add --no-cache --update \
2024-12-14 22:15:00 +00:00
${DC_DOCKER_PHP}-common \
${DC_DOCKER_PHP}-cli \
${DC_DOCKER_PHP}-fpm \
${DC_DOCKER_PHP}-session \
${DC_DOCKER_PHP}-curl \
${DC_DOCKER_PHP}-gd \
${DC_DOCKER_PHP}-gmp \
${DC_DOCKER_PHP}-exif \
${DC_DOCKER_PHP}-tidy \
${DC_DOCKER_PHP}-intl \
${DC_DOCKER_PHP}-json \
${DC_DOCKER_PHP}-mbstring \
${DC_DOCKER_PHP}-iconv \
${DC_DOCKER_PHP}-gettext \
${DC_DOCKER_PHP}-mysqli \
${DC_DOCKER_PHP}-pgsql \
${DC_DOCKER_PHP}-opcache \
${DC_DOCKER_PHP}-dom \
${DC_DOCKER_PHP}-xml \
${DC_DOCKER_PHP}-simplexml \
${DC_DOCKER_PHP}-zip \
${DC_DOCKER_PHP}-pdo_sqlite
2024-11-24 12:55:58 +00:00
# Copy PHP configuration
2024-12-14 22:15:00 +00:00
COPY etc/${DC_DOCKER_CANAL}-php.ini /etc/${DC_DOCKER_PHP}/php.ini
COPY etc/php-fpm.conf /etc/${DC_DOCKER_PHP}/php-fpm.d/www.conf
2024-11-24 12:55:58 +00:00
##
# Dotclear
##
# Download latest Dotclear version
RUN curl -fsSL -o versions.xml "http://download.dotclear.org/versions.xml" \
2024-12-14 22:15:00 +00:00
&& 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='$DC_DOCKER_CANAL']/@checksum" versions.xml | awk -F'[="]' '!/>/{print $(NF-1)}') dotclear.zip" | md5sum -c - \
2024-11-24 12:55:58 +00:00
&& mkdir -p /usr/src/dotclear \
&& unzip -d /usr/src dotclear.zip \
2024-12-12 23:44:41 +00:00
&& rm dotclear.zip
2024-11-24 12:55:58 +00:00
2024-12-14 11:13:04 +00:00
# Create predefined www structure
2024-11-24 12:55:58 +00:00
COPY www /var/lib/dotclear
2024-12-01 00:33:01 +00:00
##
# Plugins
##
# DotclearWatch
2024-12-26 20:08:35 +00:00
RUN curl -fsSL -o plugin.zip "https://github.com/JcDenis/DotclearWatch/releases/download/v$DC_DOCKER_PLUGIN_DOTCLEARWATCH/plugin-DotclearWatch.zip" \
2024-12-01 00:33:01 +00:00
&& mkdir -p /var/lib/dotclear/plugins/DotclearWatch \
&& unzip -d /var/lib/dotclear/plugins plugin.zip \
&& rm plugin.zip
2024-12-05 20:24:37 +00:00
# dcLog
2024-12-14 22:15:00 +00:00
RUN curl -fsSL -o plugin.zip "https://github.com/JcDenis/dcLog/releases/download/v$DC_DOCKER_PLUGIN_DCLOG/plugin-dcLog.zip" \
2024-12-05 20:24:37 +00:00
&& mkdir -p /var/lib/dotclear/plugins/dcLog \
&& unzip -d /var/lib/dotclear/plugins plugin.zip \
&& rm plugin.zip
2024-12-01 00:33:01 +00:00
# sysInfo
2024-12-14 22:15:00 +00:00
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" \
2024-12-01 00:33:01 +00:00
&& mkdir -p /var/lib/dotclear/plugins/sysInfo \
&& unzip -d /var/lib/dotclear/plugins plugin.zip \
&& rm plugin.zip
2024-11-24 12:55:58 +00:00
##
# END
##
2024-12-14 22:15:00 +00:00
# Fix ownership
RUN chown -R www:www /var/lib/dotclear /usr/src/dotclear
2024-11-24 12:55:58 +00:00
# Docker container uses port 80
EXPOSE 80
# Set working diretory for container starting script
WORKDIR /var/www/dotclear/app
# Add container starting script
ADD docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
# Docker container healthcheck
2024-11-11 16:56:16 +00:00
HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:80/fpm-ping || exit 1