Build your own image
You must have the following tools installed locally:
- Python3
PyYAML
Python package (either via pip or OS packet manager)make
docker
You should have a brief understanding about the different flavours available in this repository.
ℹ️ For details see README.md#flavours
ℹ️ For details see Documentation: Flavours
This repository already has all the automation in place.
- For each PHP version a
base
image is built to streamline settings across all PHP versions. - Based on the
base
image, amods
image is built, which only adds a whole bunch of PHP extensions. - Based on the
mods
image, aprod
image is built, which adds features to alter the startup behaviour. - Based on the
prod
image, awork
image is built, which acts as an integrated development environment in which you can actually work (adds a whole bunch of tools).
What you need to do, is to:
- Ensure the
base
image is available locally on your system (either by building it or by pulling it). - Decide on the PHP extensions that you want to add
- Decide on the PHP version you want to build
- Decide on the architecture/platform you want to build the Docker image for (
amd64
orarm64
). - Build the
mods
image (or just create the Dockerfile for it).
With this you will be all set, you can however decide to build the prod
flavour on top of your custom mods
image as it adds a lot of configurable environment variables to dynamically alter the startup behaviour.
In case you plan to use your custom image for the Devilbox, you must also go ahead and built the work
flavour on top of the prod
flavour.
Note: All commands are executed in the root of this repository
- Generate Dockerfiles with desired PHP extensions
# Generate Dockerfiles with all available PHP extensions make gen-dockerfiles
# Generate Dockerfiles for selected PHP extensions only # Note: that also all dependent extensions will be added make gen-dockerfiles MODS="msgpack xsl"
# Generate Dockerfiles for selected PHP extensions # and ignore dependencies make gen-dockerfiles MODS="-i msgpack xsl"
Note: All commands are executed in the root of this repository
- Ensure you have the
base
image locally for your desired version and architectureARCH=linux/amd64 VERSION=8.1 make docker-pull-base-image STAGE=mods VERSION=${VERSION} ARCH=${ARCH}
- Build the
mods
imageARCH=linux/amd64 VERSION=8.1 make build STAGE=mods VERSION=${VERSION} ARCH=${ARCH}
- (Optional) Build the
prod
imageARCH=linux/amd64 VERSION=8.1 make build STAGE=prod VERSION=${VERSION} ARCH=${ARCH}
- (Optional) Build the
work
imageARCH=linux/amd64 VERSION=8.1 make build STAGE=work VERSION=${VERSION} ARCH=${ARCH}
- Where do I find the generated Dockerfile?
- How can I omit dependent PHP extensions when generating the Dockerfile?
- How do I ensure that dependent PHP extensions are automatically added to the Dockerfile?
- Where do I see what PHP extensions are available in this repository?
- How do I know what each of the provided PHP extensions is for?
- How can I add PHP extensions that are not provided here?
- Switching architectures fails with errors, what should I do?