-
Notifications
You must be signed in to change notification settings - Fork 130
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
[Proposal] Recommend using multi-stage build to use composer #22
Comments
Just to clarify, you're suggesting to add this to the readme/docs that are presented on the Docker hub? |
There is one drawback though: Composer needs the Zip extension at runtime, and may need VCS tools (if you install from source). When using a multi-stage builds, these are needed in your own image. |
@alcohol yes, this proposal is about documentation |
Alright, I'm in favor of documenting this 👍 . But indeed, word of caution should also be added regarding possibly required tooling/extensions. |
Docs can be adjusted by forking https://github.com/docker-library/docs and then changing the files inside the |
The multistage build can be used to build the app inside the composer container and copy over the app to the final image. The new --chown flag for COPY (docker 17.09) will take care of the permissions. (Changing permissions in the final image would lead to an additional layer with the size of all changed files). |
@t3easy but you have the same drawback than the current usage of a separate container to use Composer: platform packages are based on the PHP runtime added in the composer image, not on your actual PHP runtime, impacting the dependency resolution. |
Does docker-library/docs#1017 suffice for now? |
See https://medium.com/@othillo/adding-composer-to-php-docker-images-using-multi-stage-builds-2a10967ae6c1 for the explanation about this feature.
A common issue with people using this image is that they run composer inside the container generated by this image, which may have different platform packages than their actual runtime. Here are some issues they may face:
The text was updated successfully, but these errors were encountered: