Repository navigation
Keep the composer cache in a named volume and add portsHost - #338
Merged
Merged
Conversation
The cache now lives on the docker host, so it works when that host is remote. portsHost is the address published ports listen on, 127.0.0.1 by default. Workshop images need RUN mkdir -m 1777 /solution /composer.
SandboxHost has the address to connect to published ports on and picks free ports, so exercises no longer assume the code runs on this machine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second task of #336 (Docker groundwork).
php-school-composer-cachenamed volume mounted at/composer, so it lives on the docker host, even a remote one. ThecomposerCacheDirconstructor argument is gone.portsHostoption: the address published ports listen on,127.0.0.1by default.$context->getSandboxHost()hasgetAddress()(where to connect to published ports) andgetFreePort().SandboxgainsgetHost(), andExerciseDispatchertakes the sandbox to fill it in. For nowgetFreePort()asks this machine, so the Fly task needs to change it.RUN mkdir -m 1777 /solution /composer(added to learn-you-php#117 and php8-appreciate#49). Docker gives a new volume the permissions of the image directory, so any user can write to the cache.Tried with a real container:
composer installas a non-root user writes to the cache volume. learn-you-php's TimeServer passes on Docker and host using the sandbox host.Once this is merged: phpschool.io drops its composer cache dir, and learn-you-php's TimeServer moves to
getSandboxHost().