-
Notifications
You must be signed in to change notification settings - Fork 365
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
Add Dockerfile for development #945
base: 2.0
Are you sure you want to change the base?
Conversation
- 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
Outdated
gzip \ | ||
unzip | ||
|
||
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
- Add extension-install image instead of using ADD. - Remove gzip since it's not needed. - Change USERNAME to FakerPHP.
Is it an idea to also integrate our tooling to run via docker instead? Since right now, what is a solid way to run stuff without complex cli commands? |
What is the reason for this PR?
Dockerfile to build an image with the FakerPHP dev dependencies.
It doesn't impact end users, it just improves the DX (Developer Experience) for anyone that wants to contribute to the repo without having to worry about installing any dependency (e.g. php, composer, make) on the host machine.
You just need to:
docker build -t php8.3-composer .
alias php8.3="docker run -it --rm -v .:/app -w /app php8.3-composer"
php8.3 make cs
Note:
ADD
is meant to facilitate the installation of extensions. You can verify that the script is even mentioned in the README of the offical PHP image:8.3
since there seems to be a dependency that requires a max of 8.3.X. Composer defaults tolatest
. You can override these defaults usingdocker build --build-args
, allowing you to have multiple versions to work with (by setting multiple alias).Let me know what you think, I will add some info to the README if you find this useful.