Container images#
This page describes the two base images FairDM publishes for portals, the tags they are published under, what the images contain, the variables and commands they understand, the start sequence, and the record of the image and database versions that FairDM declares. It does not give the steps to build or run a portal, which are in How to deploy a portal in a container, or the reasons behind the versioning, which are in How the container images are versioned.
The images#
Both images are built from docker/Dockerfile in the FairDM repository. Neither contains FairDM or any portal code. A portal installs its own locked dependencies, FairDM among them.
Runtime image |
Development image |
|
|---|---|---|
Dockerfile target |
|
|
Registry name |
|
|
Built from |
|
The runtime image |
Added system packages |
|
|
|
|
|
Used for |
Running a portal |
Installing a portal’s dependencies, and running a portal on your own machine |
Both images are published for linux/amd64. GDAL, GEOS and PROJ come with gdal-bin and are found without GDAL_LIBRARY_PATH or GEOS_LIBRARY_PATH.
<image version> is a three-part version such as 1.0.0. It is the version of the images and not of FairDM. There is no latest tag, and a published tag is never replaced. A release is also recorded as the Git tag and GitHub release image-v<image version>.
What is in an image#
Item |
Value |
|---|---|
Working directory |
|
Python environment |
|
User |
|
Directories created |
|
Backup tools |
|
Package manager |
uv 0.11, copied from |
Exposed port |
|
Entrypoint |
|
Default command |
|
The images carry these OCI labels: org.opencontainers.image.title, description, source, licenses (MIT) and version. The version label takes the VERSION build argument, which defaults to dev.
Environment variables the image sets#
Variable |
Value |
Notes |
|---|---|---|
|
|
See DJANGO_ENV |
|
|
Set another value in a portal whose settings module is elsewhere |
|
|
gunicorn listens on |
|
|
Where a portal with local media writes its backups. Mount a volume here. See BACKUP_DIR |
|
|
Keeps the environment outside |
|
|
|
|
|
uv uses the image’s Python |
|
|
|
|
|
|
|
|
Environment variables the entrypoint reads#
Variable |
Default |
What it does |
|---|---|---|
|
|
The directory the |
|
|
The WSGI application gunicorn serves |
|
|
The application the |
|
|
Read by gunicorn for its address |
Variables a production portal needs#
The web command starts the portal on the production baseline, so the production checks apply. These variables are the ones the checks require. Each is described in Settings.
Variable |
Required |
Notes |
|---|---|---|
Yes |
At least 50 characters, with no default |
|
Yes, or |
Added to |
|
No |
A comma-separated list of further hosts |
|
|
Yes, or |
|
Yes, or the |
||
Yes |
The cache and the Celery broker |
Commands#
The first argument of docker run after the image name selects what the container does.
Command |
What it runs |
|---|---|
|
The start sequence, ending in gunicorn |
|
|
|
|
Anything else |
The command as given, with no start sequence. |
Start sequence#
The web command runs these steps in this order. It stops at the first one that fails and exits with that step’s status, and gunicorn does not start.
python manage.py migrate --noinputpython manage.py collectstatic --noinputEach start step, one at a time
gunicorn $WSGI_APP, started withexec
Static files are collected when the container starts, so settings that arrive through the environment apply to them.
Start steps#
A start step is a file in the start directory, /docker-entrypoint.d unless FAIRDM_START_DIR names another.
Rule |
Behaviour |
|---|---|
Which files |
Every regular file in the directory |
Order |
The order of the file names. Prefix the names with numbers to choose it. |
A file that is not executable |
Skipped, with |
A missing or empty directory |
The sequence runs with no start steps |
A step that exits with a non-zero status |
The start stops with that status |
User, directory and environment |
The user |
A directory the |
Treated as empty, so no step runs |
The worker, beat and any other command run no start steps. How to add a start step to a container shows how to add one.
Portal image build arguments#
docker/portal.Dockerfile builds a portal’s production image on the base images. A portal copies the file into its own repository.
Build argument |
Default |
What it does |
|---|---|---|
|
|
The registry name of the base images |
|
None |
The image version to build on. The build fails without it. |
The build installs the locked dependencies with uv sync --locked --no-dev on the development image, then copies the environment and the portal’s code onto the runtime image. It needs a pyproject.toml, a uv.lock and a README.md in the portal’s root.
[tool.fairdm.platform]#
FairDM records the image and the database it is tested on in its pyproject.toml:
[tool.fairdm.platform]
image = "1.0.0"
postgis = "17-3.5"
Key |
Type |
What it holds |
|---|---|---|
|
|
The image version FairDM is tested on, a version of the images described on this page |
|
|
The tag of the |
A portal reads the table at the FairDM release or commit it pins and uses the image version and the PostGIS tag that it declares. FairDM’s own workflows read postgis from the table.