I would like to run the Phan tool for static PHP-code checking using Gitlab CI and docker, but I’m currenlty stuck on how to proceed. I would like to use the cloudflare/docker-phan container as it is quite small.
However, If i understand correctly, as there is an entrypoint set in the Dockerfile of the container, it does not work with the docker executor (documentation). I’m stuck at writing a correct a correct .gitlab-ci.yml
file which can overcome this problem.
Should I use the docker-in-a-docker approach for this? Because when I read this article, it appears to be a bad idea. It looks like I should use the docker
container and than as command something to start the docker-phan
container. However, it leaves me with a second questions: how can I pass the -v option in the configuration?
So currently I have something like this:
stages:
- test
php-lint:
image: docker
stage: test
script:
- docker run --rm -v $PWD:/mnt/src --entrypoint /sbin/tini cloudflare/phan:latest ls -l --
I did not have the chance to test this: is there any way to test the configuration without committing it? So an actual test run, not the CI lint…
Finally, I believe the Gitlab CI services are a no go in this situation, as the specified docker container does not keep running after starting. Is that a correct assumption?