Skip to content

Add Dockerfile for development #945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use the same mechanic here as with composer: copying the script from the docker image

Copy link
Author

@Head0nF1re Head0nF1re Feb 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it would be fine. ADD needs to download the file each time to calculate the hash and decide if it should invalidate the cache, using the image would skip the downloading part which is better.

We just need to add some info in the README warning about potentially stale images and the need to use build --pull as needed. Could also use something like watchtower but since this is just for local development I don't see a need

Copy link
Author

@Head0nF1re Head0nF1re Feb 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the ADD and added the extension-installer image


RUN install-php-extensions intl

USER $USERNAME