PHP Images for CI
This is an example of how you compile software meant to be later part of a Docker image, but doing so outside of the image itself. This results in cleanly built images without unnecessary artifacts.
I use this container image(s) to test PHP scripts of mine.
- The "official" images are bloated, and a butchery.
- I strongly disliked that the usual third-party CI services take minutes until picking up jobs, and hence use my own CI/CD setup powered by Docker.
- I want to show you a better way of building software out-of-Dockerfiles for containers.
How It's Done
Gitlab-CI (could be any other CI) reads the commands from the supplied
.gitlab-ci.yml file. That is, for every stage a new container is started
and lines '*script' are run one by one.
The default image is blitznote/debootstrap-amd64:16.04 (Ubuntu 16.04.1)
It's, for the first stage build:
docker run -v $(pwd):/data -ti --rm \ --tmpfs /tmp:exec,mode=1777 \ blitznote/debootstrap-amd64:16.04
… when inside the container:
apt-get -q update apt-get -y install gcc build-essentials xz-utils cd /data ./compile.sh ./make-debs.sh
Stage test is a dummy.