feat: Refactor DEV imgs

This commit is contained in:
Vincent BRIDIER 2025-07-18 09:43:38 +02:00
parent 5d06dffd1e
commit cffae6a4e6
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
3 changed files with 154 additions and 234 deletions

View file

@ -1,95 +1,74 @@
FROM php:7.3-apache
RUN apt-get update -qq && \
apt-get install -qy \
# Common
nano \
vim \
# GD
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libwebp-dev \
libxpm-dev \
# INTL
zlib1g-dev libicu-dev g++ \
# XSL
libxslt-dev \
# ZIP
libzip-dev \
unzip \
zip \
# Imagick
libmagick++-dev \
libmagickwand-dev \
# Memcached
libmemcached-dev \
# ldap
ldap-utils libldap2-dev \
# locales
locales
ENV DEBIAN_FRONTEND=noninteractive
# LOCALES
ENV DEBIAN_FRONTEND noninteractive
RUN echo "fr_FR.UTF-8 UTF-8" > /etc/locale.gen && \
# 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 \
libmemcached-dev \
ldap-utils libldap2-dev \
locales \
git zsh \
ca-certificates curl gnupg \
mariadb-client && \
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
ENV LC_ALL fr_FR.UTF-8
ENV LANG fr_FR.UTF-8
ENV LANGUAGE fr_FR.UTF-8:fr
# END LOCALES
/usr/sbin/update-locale LANG=fr_FR.UTF-8 && \
docker-php-ext-configure gd \
--with-gd \
--with-webp-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-xpm-dir \
--with-freetype-dir && \
docker-php-ext-configure intl && \
docker-php-ext-configure zip --with-libzip && \
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.6.0 xdebug-3.1.5 pcov && \
docker-php-ext-enable imagick xdebug pcov && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN docker-php-ext-configure gd \
--with-gd \
--with-webp-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-xpm-dir \
--with-freetype-dir
# Set locale environment variables
ENV LC_ALL=fr_FR.UTF-8
ENV LANG=fr_FR.UTF-8
ENV LANGUAGE=fr_FR.UTF-8:fr
RUN docker-php-ext-configure intl
RUN docker-php-ext-configure zip --with-libzip
RUN docker-php-ext-configure ldap
RUN docker-php-ext-install exif gd gettext intl mysqli pdo_mysql xsl opcache zip bcmath ldap
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN pecl install imagick-3.6.0 && docker-php-ext-enable imagick
RUN pecl install memcached-3.1.5 && docker-php-ext-enable memcached
# Install Node.js 18.x
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y --no-install-recommends nodejs && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN useradd -ms /bin/bash noroot
# Setup Oh-My-Zsh and plugins
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
# DEV
RUN apt-get install -qy git zsh
USER noroot
RUN sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# caractères illisibles - RUN sed -i 's/robbyrussell/agnoster/g' ~/.zshrc
RUN sed -i 's/plugins=(git)/plugins=(git laravel zsh-autosuggestions)/g' ~/.zshrc
# local-php-security-checker
RUN curl -L https://github.com/fabpot/local-php-security-checker/releases/download/v2.0.4/local-php-security-checker_2.0.4_linux_amd64 -o /home/noroot/local-php-security-checker && chmod +x /home/noroot/local-php-security-checker && echo 'alias local-php-security-checker="/home/noroot/local-php-security-checker"' >> ~/.zshrc
ENV SHELL=/bin/zsh
USER root
# Set default shell to zsh
RUN chsh -s /bin/zsh
RUN pecl install xdebug
RUN pecl install pcov && docker-php-ext-enable pcov
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get install -y nodejs
RUN apt-get install -y mariadb-client
## DEV
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# 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/vhost.conf /etc/apache2/sites-available/000-default.conf
# Enable Apache modules and configuration
RUN a2enmod rewrite remoteip headers http2 && \
a2enconf z-app
USER noroot
WORKDIR /app/srcs
WORKDIR /app/srcs

View file

@ -1,101 +1,71 @@
FROM php:8.3-apache-bullseye
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies and PHP extensions
RUN apt-get update -qq && \
apt-get install -qy \
# Common
nano \
vim \
# GD
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libwebp-dev \
libxpm-dev \
# INTL
zlib1g-dev libicu-dev g++ \
# XSL
libxslt-dev \
# ZIP
libzip-dev \
unzip \
zip \
# Imagick
libmagick++-dev \
libmagickwand-dev \
# Memcached
libmemcached-dev \
# ldap
ldap-utils libldap2-dev \
# locales
locales
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 \
libmemcached-dev \
ldap-utils libldap2-dev \
locales \
git zsh htop \
ca-certificates curl gnupg \
mariadb-client \
&& echo "fr_FR.UTF-8 UTF-8" > /etc/locale.gen \
&& locale-gen fr_FR.UTF-8 \
&& 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 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# LOCALES
ENV DEBIAN_FRONTEND noninteractive
RUN 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
ENV LC_ALL fr_FR.UTF-8
ENV LANG fr_FR.UTF-8
ENV LANGUAGE fr_FR.UTF-8:fr
# END LOCALES
# Set locale environment variables
ENV LC_ALL=fr_FR.UTF-8
ENV LANG=fr_FR.UTF-8
ENV LANGUAGE=fr_FR.UTF-8:fr
RUN docker-php-ext-configure gd \
--enable-gd \
--with-webp \
--with-jpeg \
--with-xpm \
--with-freetype
# Install Node.js 18.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 \
&& apt-get update -qq \
&& apt-get install -y --no-install-recommends nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-configure intl
RUN docker-php-ext-configure zip --with-zip
RUN docker-php-ext-configure ldap
RUN docker-php-ext-install exif gd gettext intl mysqli pdo_mysql xsl opcache zip bcmath ldap
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.5.5
RUN pecl install imagick-3.7.0 && docker-php-ext-enable imagick
RUN pecl install memcached-3.2.0 && docker-php-ext-enable memcached
RUN pecl install redis-6.0.2 && docker-php-ext-enable redis
# 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
RUN useradd -ms /bin/bash noroot
# DEV
RUN apt-get install -qy git zsh htop
USER noroot
RUN sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# caractères illisibles - RUN sed -i 's/robbyrussell/agnoster/g' ~/.zshrc
RUN sed -i 's/plugins=(git)/plugins=(git laravel zsh-autosuggestions)/g' ~/.zshrc
# local-php-security-checker
RUN curl -L https://github.com/fabpot/local-php-security-checker/releases/download/v2.0.4/local-php-security-checker_2.0.4_linux_amd64 -o /home/noroot/local-php-security-checker && chmod +x /home/noroot/local-php-security-checker && echo 'alias local-php-security-checker="/home/noroot/local-php-security-checker"' >> ~/.zshrc
ENV SHELL=/bin/zsh
USER root
RUN chsh -s /bin/zsh
RUN pecl install xdebug
RUN pecl install pcov && docker-php-ext-enable pcov
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.5.5
## NODE
RUN apt-get update -qq && \
apt-get install -qy \
ca-certificates curl gnupg \
&& 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" | tee /etc/apt/sources.list.d/nodesource.list
## END NODE
RUN apt-get update -qq && apt-get install -y nodejs
RUN apt-get install -y mariadb-client
## DEV
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# 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/vhost.conf /etc/apache2/sites-available/000-default.conf
# Enable Apache modules and configuration
RUN a2enmod rewrite remoteip headers http2 && \
a2enconf z-app
USER noroot
WORKDIR /app/srcs
WORKDIR /app/srcs

View file

@ -1,101 +1,72 @@
FROM php:8.4-apache-bullseye
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies and PHP extensions
RUN apt-get update -qq && \
apt-get install -qy \
# Common
nano \
vim \
# GD
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libwebp-dev \
libxpm-dev \
# INTL
zlib1g-dev libicu-dev g++ \
# XSL
libxslt-dev \
# ZIP
libzip-dev \
unzip \
zip \
# Imagick
libmagick++-dev \
libmagickwand-dev \
# Memcached
libmemcached-dev \
# ldap
ldap-utils libldap2-dev \
# locales
locales
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 \
libmemcached-dev \
ldap-utils libldap2-dev \
locales \
git zsh htop \
ca-certificates curl gnupg \
mariadb-client \
&& 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 \
&& 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.2.0 xdebug pcov \
&& docker-php-ext-enable imagick redis xdebug pcov \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# LOCALES
ENV DEBIAN_FRONTEND noninteractive
RUN 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
ENV LC_ALL fr_FR.UTF-8
ENV LANG fr_FR.UTF-8
ENV LANGUAGE fr_FR.UTF-8:fr
# END LOCALES
# Set locale environment variables
ENV LC_ALL=fr_FR.UTF-8
ENV LANG=fr_FR.UTF-8
ENV LANGUAGE=fr_FR.UTF-8:fr
RUN docker-php-ext-configure gd \
--enable-gd \
--with-webp \
--with-jpeg \
--with-xpm \
--with-freetype
# Install Node.js 18.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 \
&& apt-get update -qq \
&& apt-get install -y --no-install-recommends nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-configure intl
RUN docker-php-ext-configure zip --with-zip
RUN docker-php-ext-configure ldap
RUN docker-php-ext-install exif gd gettext intl mysqli pdo_mysql xsl opcache zip bcmath ldap
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.5.5
RUN pecl install imagick-3.7.0 && docker-php-ext-enable imagick
RUN pecl install memcached-3.2.0 && docker-php-ext-enable memcached
RUN pecl install redis-6.2.0 && docker-php-ext-enable redis
# 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
RUN useradd -ms /bin/bash noroot
# DEV
RUN apt-get install -qy git zsh htop
USER noroot
RUN sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# caractères illisibles - RUN sed -i 's/robbyrussell/agnoster/g' ~/.zshrc
RUN sed -i 's/plugins=(git)/plugins=(git laravel zsh-autosuggestions)/g' ~/.zshrc
# local-php-security-checker
RUN curl -L https://github.com/fabpot/local-php-security-checker/releases/download/v2.0.4/local-php-security-checker_2.0.4_linux_amd64 -o /home/noroot/local-php-security-checker && chmod +x /home/noroot/local-php-security-checker && echo 'alias local-php-security-checker="/home/noroot/local-php-security-checker"' >> ~/.zshrc
ENV SHELL=/bin/zsh
USER root
RUN chsh -s /bin/zsh
RUN pecl install xdebug
RUN pecl install pcov && docker-php-ext-enable pcov
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.5.5
## NODE
RUN apt-get update -qq && \
apt-get install -qy \
ca-certificates curl gnupg \
&& 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" | tee /etc/apt/sources.list.d/nodesource.list
## END NODE
RUN apt-get update -qq && apt-get install -y nodejs
RUN apt-get install -y mariadb-client
## DEV
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# 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/vhost.conf /etc/apache2/sites-available/000-default.conf
# Enable Apache modules and configuration
RUN a2enmod rewrite remoteip headers http2 && \
a2enconf z-app
USER noroot
WORKDIR /app/srcs
WORKDIR /app/srcs