ldc-web-images-docker/PHP8.5/DEV/Dockerfile
2026-03-19 15:39:48 +01:00

114 lines
4 KiB
Docker

FROM php:8.5.4-apache-trixie
ENV DEBIAN_FRONTEND=noninteractive
ARG http_proxy
ENV http_proxy=${http_proxy}
ENV https_proxy=${http_proxy}
ENV HTTP_PROXY=${http_proxy}
ENV HTTPS_PROXY=${http_proxy}
# Install system dependencies and PHP extensions
RUN apt-get update -qq && \
apt-get install -qy --no-install-recommends \
nano vim \
libfreetype6-dev libjpeg62-turbo-dev libpng-dev libwebp-dev libxpm-dev \
zlib1g-dev libicu-dev g++ \
libxslt-dev \
libzip-dev unzip zip \
libmagick++-dev libmagickwand-dev imagemagick \
libcurl4-openssl-dev \
libmemcached-dev \
ldap-utils libldap2-dev \
locales \
git zsh htop \
ca-certificates curl gnupg \
mariadb-client \
libonig-dev \
build-essential pkg-config autoconf libtool \
&& echo "fr_FR.UTF-8 UTF-8" > /etc/locale.gen \
&& locale-gen fr_FR.UTF-8 \
&& dpkg-reconfigure locales \
&& /usr/sbin/update-locale LANG=fr_FR.UTF-8
RUN docker-php-ext-configure gd --enable-gd --with-webp --with-jpeg --with-xpm --with-freetype \
&& docker-php-ext-configure zip --with-zip \
&& docker-php-ext-install -j$(nproc) exif gd gettext intl mysqli pdo_mysql xsl zip bcmath ldap gmp
# PECL PROXY HACK
RUN if [ -n "${http_proxy}" ]; then \
pear config-set http_proxy "${http_proxy}"; \
fi
# PECL EXTENSIONS
RUN pecl channel-update pecl.php.net \
&& pecl install imagick-3.8.1 redis-6.3.0 \
&& docker-php-ext-enable imagick redis
RUN pecl install xdebug pcov \
&& docker-php-ext-enable xdebug pcov
# CLEAN UP XDEBUG ENABLE
RUN rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
# CLEANUP
RUN apt-get clean \
&& apt-get purge -y --auto-remove build-essential pkg-config autoconf \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Set locale environment variables
ENV LC_ALL=fr_FR.UTF-8
ENV LANG=fr_FR.UTF-8
ENV LANGUAGE=fr_FR.UTF-8:fr
# Install Node.js 24.x
RUN mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_24.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
&& apt-get update -qq \
&& apt-get install -y --no-install-recommends nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Bun
RUN set -eux; \
dir="${BUN_INSTALL:-$HOME/.bun}/bin"; mkdir -p "$dir"; \
url="https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64.zip"; \
curl -fsSL -o /tmp/bun.zip "$url"; \
unzip -oqd "$dir" /tmp/bun.zip; \
bunbin=$(find "$dir" -type f -name 'bun*' -perm /a+x | head -n1); \
[ -n "$bunbin" ] && mv -f "$bunbin" "$dir/bun"; \
chmod +x "$dir/bun" || true; \
rm -f /tmp/bun.zip; \
ln -sf "$dir/bun" /usr/local/bin/bun
# Install Composers
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.9.5
# Setup Oh-My-Zsh and plugins (dev only)
RUN sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" \
&& git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \
&& sed -i 's/plugins=(git)/plugins=(git laravel zsh-autosuggestions)/g' ~/.zshrc \
&& sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="agnoster"/g' ~/.zshrc
ENV SHELL=/bin/zsh
# Set default shell to zsh
RUN chsh -s /bin/zsh
# Copy configuration files
COPY conf/common-apache.conf /etc/apache2/conf-available/z-app.conf
COPY conf/common-ports.conf /etc/apache2/ports.conf
COPY conf/common-security.conf /etc/apache2/conf-enabled/security.conf
COPY conf/php.ini /usr/local/etc/php/conf.d/app.ini
COPY conf/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
COPY conf/vhost.conf /etc/apache2/sites-available/000-default.conf
# Enable Apache modules and configuration
RUN a2enmod rewrite remoteip headers http2 && \
a2enconf z-app
# XDEBUG LOGS
RUN mkdir -p /app/logs/
WORKDIR /app/srcs