-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Run arbitrary commands within the container #57
Comments
Would it be possible to add a option like "BEFORE_RUN_CMD" and run it before the tests ? ( I was trying to add mysql-client to the container ) I tried to build a dockerfile and put the commands in but failed... ....
echo "FROM ${docker_tag}" > Dockerfile
if [ -n "$BEFORE_RUN_CMD" ]
then
echo "RUN ${BEFORE_RUN_CMD}" >> Dockerfile
fi
echo "CMD ${command_string[@]}" >> Dockerfile
cat Dockerfile.ymal
docker build -t phpunit_container .
docker run --rm \
--name phpunit \
--volume "${phar_path}":/usr/local/bin/phpunit \
--volume "${GITHUB_WORKSPACE}":/app \
--workdir /app \
--network host \
--env-file <( env| cut -f1 -d= ) \
phpunit_container |
That idea is certainly on the right tracks. However I think it would be better to run something like MySQL in its own container so it can be managed in its own step - but then it would require the change here to be able to configure which ports are exposed to the PHPUnit container. I have a feeling that the BEFORE_RUN_CMD idea might have issues, due to how the Dockerfile is built into a Package and stored on Github's container registry. I will give it some thought! |
MySql server is in it's own container and that worked fine I just passed the I'm clueless to how Github's container registry works, but another idea I pondered was delaying the execution of phpunit to allow commands to be executed before using |
Gotcha. I see the issue you're explaining. I'll look into how MySQL Client can be included in the PHP Alpine container, as it might just make sense to include it by default, seeing how close friends PHP and MySQL are. What do you think to that idea? |
Sounds good, thanks! |
Many CI workflows configure the workspace environment before executing. This Github Action works in a way that completely isolates the test runner from the environment, by running your tests in its own Docker container, sharing only the project source files.
It would be useful to run any arbitrary shell command within the container. This should probably be transferred to other php-actions too.
The text was updated successfully, but these errors were encountered: