diff --git a/PHP8.3/DEV/Dockerfile b/PHP8.3/DEV/Dockerfile index 5825cd2..2536dae 100644 --- a/PHP8.3/DEV/Dockerfile +++ b/PHP8.3/DEV/Dockerfile @@ -1,7 +1,24 @@ -FROM php:8.3-apache-bullseye +FROM php:8.3-apache-bookworm ENV DEBIAN_FRONTEND=noninteractive +ARG HTTP_PROXY +ARG HTTPS_PROXY +ARG NO_PROXY +ARG http_proxy +ARG https_proxy +ARG no_proxy + +ENV http_proxy=${http_proxy} \ + https_proxy=${http_proxy} \ + HTTP_PROXY=${http_proxy} \ + HTTPS_PROXY=${http_proxy} \ + no_proxy=${no_proxy} \ + NO_PROXY=${no_proxy} + +# Install PIE +ADD --chmod=0755 https://github.com/php/pie/releases/latest/download/pie.phar /usr/local/bin/pie + # Install system dependencies and PHP extensions RUN apt-get update -qq && \ apt-get install -qy --no-install-recommends \ @@ -10,48 +27,70 @@ RUN apt-get update -qq && \ zlib1g-dev libicu-dev g++ \ libxslt-dev \ libzip-dev unzip zip \ - libmagick++-dev libmagickwand-dev \ + 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 \ libcap2-bin \ && echo "fr_FR.UTF-8 UTF-8" > /etc/locale.gen \ && locale-gen fr_FR.UTF-8 \ - && update-locale LANG=fr_FR.UTF-8 \ + && dpkg-reconfigure locales \ + && /usr/sbin/update-locale LANG=fr_FR.UTF-8 \ && docker-php-ext-configure gd --enable-gd --with-webp --with-jpeg --with-xpm --with-freetype \ - && docker-php-ext-configure intl \ && docker-php-ext-configure zip --with-zip \ && docker-php-ext-configure ldap \ && docker-php-ext-install -j$(nproc) exif gd gettext intl mysqli pdo_mysql xsl opcache zip bcmath ldap \ - && pecl install imagick-3.7.0 redis-6.0.2 xdebug pcov \ - && docker-php-ext-enable imagick redis xdebug pcov \ + && pie install imagick/imagick \ + && pie install phpredis/phpredis \ + && pie install xdebug/xdebug \ + && git clone --depth=1 https://github.com/krakjoe/pcov.git /tmp/pcov \ + && cd /tmp/pcov && phpize && ./configure && make -j$(nproc) install \ + && docker-php-ext-enable pcov \ + && rm -rf /tmp/pcov \ && 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 +ENV LC_ALL=fr_FR.UTF-8 \ + LANG=fr_FR.UTF-8 \ + LANGUAGE=fr_FR.UTF-8:fr -# Install Node.js 18.x +# 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_18.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \ + && 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 Composer 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/plugins=(git)/plugins=(git laravel zsh-autosuggestions)/g' ~/.zshrc \ + && sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="agnoster"/g' ~/.zshrc ENV SHELL=/bin/zsh @@ -63,6 +102,7 @@ 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 @@ -71,7 +111,13 @@ RUN a2enmod rewrite remoteip headers http2 && \ #Change access righs to conf, logs, bin from root to www-data RUN chown -hR www-data:www-data /var/log/apache2 -#setcap to bind to privileged ports as non-root RUN setcap 'cap_net_bind_service=+ep' /usr/sbin/apache2 +# 13. Dossier de logs +RUN mkdir -p /app/logs/ + +# 14. Fix entrypoint attendu par uwildev Compose +RUN printf '#!/bin/sh\nset -e\nif [ "$#" -eq 0 ]; then\n exec apache2-foreground\nfi\nexec "$@"\n' > /usr/local/bin/docker-entrypoint.sh \ + && chmod +x /usr/local/bin/docker-entrypoint.sh + WORKDIR /app/srcs diff --git a/PHP8.3/DEV/conf/common-ports.conf b/PHP8.3/DEV/conf/common-ports.conf index d48cbbd..9f2be18 100644 --- a/PHP8.3/DEV/conf/common-ports.conf +++ b/PHP8.3/DEV/conf/common-ports.conf @@ -2,7 +2,7 @@ # have to change the VirtualHost statement in # /etc/apache2/sites-enabled/000-default.conf -#Listen 80 +Listen 80 Listen 443 # vim: syntax=apache ts=4 sw=4 sts=4 sr noet \ No newline at end of file diff --git a/PHP8.3/DEV/conf/vhost.conf b/PHP8.3/DEV/conf/vhost.conf index f15297b..4a3a15c 100644 --- a/PHP8.3/DEV/conf/vhost.conf +++ b/PHP8.3/DEV/conf/vhost.conf @@ -1,4 +1,4 @@ - + Protocols h2 h2c http/1.1 ServerAdmin contact@ldc.fr DocumentRoot /app/${DOCUMENTROOT} diff --git a/PHP8.3/DEV/conf/xdebug.ini b/PHP8.3/DEV/conf/xdebug.ini new file mode 100644 index 0000000..2242ce8 --- /dev/null +++ b/PHP8.3/DEV/conf/xdebug.ini @@ -0,0 +1,9 @@ +zend_extension=xdebug + +[xdebug] +xdebug.mode=debug +xdebug.client_host=host.docker.internal +xdebug.start_with_request=yes +xdebug.cli_color=1 +xdebug.log=/app/logs/xdebug_${PROJECT}.log +xdebug.log_level=3