The Gist shows how to run the PHP script in a controlled environment using Docker.
Define all the necessary libraries and extensions in the Dockerfile. The file in the Gist provides some examples;
check it for tricks and inspiration. Next, build a local image using the command make build
.
For example, run the composer update
command in the project folder using the Docker container.
docker run --rm --interactive --tty \
--volume $PWD:/app \
--volume /run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock \
--env SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock \
--workdir /app \
php-local:7.4.10 composer install
We mount SSH keys from the SSH agent using macOS specific hack.