From 8b15f90673d41811a52fdf2a83e6ce87e1c0a66c Mon Sep 17 00:00:00 2001 From: Head0nF1re <77078775+Head0nF1re@users.noreply.github.com> Date: Sat, 8 Feb 2025 19:47:59 +0000 Subject: [PATCH 1/2] Add Dockerfile for development - Dockerfile to build an image with the FakerPHP dev dependencies. Allows devs to work on the repo without having to install any dependencies (e.g. php, composer, make) on the host machine. --- Dockerfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..265e86214 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +ARG PHP_VERSION=8.3 \ + COMPOSER_VERSION=latest + +# At the moment, it's NOT possible to interpolate inside the COPY --from +FROM composer:${COMPOSER_VERSION} AS composer +FROM php:${PHP_VERSION} +COPY --from=composer /usr/bin/composer /usr/bin/composer + +# https://getcomposer.org/doc/articles/troubleshooting.md#root-package-version-detection +ENV COMPOSER_ROOT_VERSION=2.0.x-dev + +ARG USERNAME=faker \ + USER_UID=1000 \ + USER_GID=$USER_UID + +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME + +RUN apt-get update && apt-get install -y \ + gzip \ + unzip + +ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ + +RUN install-php-extensions intl + +USER $USERNAME From 18355977928ef7576ec3a974a9886398b9176e2b Mon Sep 17 00:00:00 2001 From: Head0nF1re <77078775+Head0nF1re@users.noreply.github.com> Date: Sun, 9 Feb 2025 20:22:19 +0000 Subject: [PATCH 2/2] Extension-installer image, gzip and USERNAME - Add extension-install image instead of using ADD. - Remove gzip since it's not needed. - Change USERNAME to FakerPHP. --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 265e86214..a87594ce3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,18 @@ ARG PHP_VERSION=8.3 \ - COMPOSER_VERSION=latest + COMPOSER_VERSION=latest \ + EXTENSION_INSTALLER_VERSION=latest # At the moment, it's NOT possible to interpolate inside the COPY --from +FROM mlocati/php-extension-installer:${EXTENSION_INSTALLER_VERSION} AS extension-installer FROM composer:${COMPOSER_VERSION} AS composer FROM php:${PHP_VERSION} COPY --from=composer /usr/bin/composer /usr/bin/composer +COPY --from=extension-installer --chmod=0755 /usr/bin/install-php-extensions /usr/local/bin/ # https://getcomposer.org/doc/articles/troubleshooting.md#root-package-version-detection ENV COMPOSER_ROOT_VERSION=2.0.x-dev -ARG USERNAME=faker \ +ARG USERNAME=FakerPHP \ USER_UID=1000 \ USER_GID=$USER_UID @@ -17,11 +20,8 @@ RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME RUN apt-get update && apt-get install -y \ - gzip \ unzip -ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ - RUN install-php-extensions intl USER $USERNAME