Docker Image Build#
Superset's Dockerfile uses a multi-stage build to produce three primary images β lean, dev, and ci β plus internal helper stages. All Python package installations are handled through docker/pip-install.sh, which wraps uv pip install and optionally installs/removes build-essential to keep final image sizes small .
Stage Overview#
The build graph looks like this:
python:3.11-slim-bookworm
ββ python-base (uv venv, bash scripts)
ββ python-translation-compiler (pybabel, .mo files)
ββ python-common (system libs, frontend assets, superset source)
ββ lean β production image
β ββ ci β lean + postgres driver
ββ dev β development image
| Stage | Build target name | Base | Requirements file | Extra packages |
|---|---|---|---|---|
python-base | (internal) | python:3.11-slim-bookworm | β | uv |
python-translation-compiler | (internal) | python-base | requirements/translations.txt | Babel |
python-common | (internal) | python-base | β | system libs, Playwright (Chromium) |
lean | lean | python-common | requirements/base.txt | β |
ci | ci | lean | (inherits lean) | .[postgres] |
dev | dev | python-common | requirements/development.txt | git, default-libmysqlclient-dev, .[postgres] |
Stage Details#
python-base #
Establishes the Python runtime. Creates a superset OS user , installs uv via pip, creates /app/.venv, and copies all docker/*.sh scripts into /app/docker/ .
No environment variables are set here; those are defined in python-common.
python-common #
The shared base for all three final images. Responsibilities:
- Sets
FLASK_APP,PYTHONPATH,SUPERSET_PORT=8088,SUPERSET_ENV=production. - Installs system APT libraries:
curl,libsasl2-dev,libpq-dev,libecpg-dev,libldap2-dev. - Installs Playwright with Chromium by default (
INCLUDE_CHROMIUM=true,INCLUDE_FIREFOX=false). - Copies compiled frontend assets from the
superset-nodestage . - Copies all of
superset/source and merges compiled.motranslation files from both frontend and backend translation stages . - Sets the default
CMDto/app/docker/entrypoints/run-server.sh.
lean β Production Image #
Installs requirements/base.txt via pip-install.sh --requires-build-essential, installs the superset package (uv pip install .), and pre-compiles Python bytecode (python -m compileall) . Drops to the superset user.
This is the image published to Docker Hub and used as the base for custom deployments.
ci β CI Image #
Extends lean. Adds uv pip install .[postgres] as root, then drops back to the superset user. Overrides CMD to /app/docker/entrypoints/docker-ci.sh .
dev β Development Image #
Extends python-common (not lean). Adds git, pkg-config, default-libmysqlclient-dev , copies all requirements/*.txt files, and installs requirements/development.txt (which includes test and lint tooling). Also installs .[postgres] . Default CMD is the same as python-common (run-server.sh), but it is normally invoked via docker-bootstrap.sh in Docker Compose.
Build Arguments#
| ARG | Default | Description |
|---|---|---|
PY_VER | 3.11.13-slim-bookworm | Python base image tag |
BUILD_TRANSLATIONS | false | Compile .po β .mo translation files |
DEV_MODE | false | Skip npm ci and npm run build in the Node stage |
INCLUDE_CHROMIUM | true | Install Playwright + Chromium for screenshot support |
INCLUDE_FIREFOX | false | Install Playwright + Firefox |
NPM_BUILD_CMD | build | npm script used for the frontend build |
Frontend Build Stage#
The Node stages (superset-node-ci β superset-node) run on the build host's native platform (--platform=${BUILDPLATFORM}) . npm ci installs dependencies; npm run ${BUILD_CMD} produces /app/superset/static/assets. The compiled assets are then COPY --from=superset-node into python-common .
Runtime Bootstrap (docker-bootstrap.sh)#
For Docker Compose deployments, containers are started via docker/docker-bootstrap.sh rather than the default CMD. At startup it:
- If
DEV_MODE=true, reinstalls the app in editable mode (uv pip install -e .) . - If
DATABASE_DIALECTstarts withpostgres, installs.[postgres]. - If
/app/docker/requirements-local.txtexists, installs it withuv pip install --no-cache-dir -r. - Routes to
app(Flask dev server),app-gunicorn,worker(Celery), orbeatbased on the first CLI argument .
Extending the Published Image#
Three patterns are supported:
1. docker/requirements-local.txt (no Dockerfile change, recommended for local dev)
Create ./docker/requirements-local.txt with additional packages and run docker compose up. docker-bootstrap.sh installs this file at container start . This file is git-ignored by convention.
2. Extend lean in a custom Dockerfile (recommended for production)
FROM apache/superset:latest
USER root
COPY requirements-local.txt .
RUN uv pip install -r requirements-local.txt
USER superset
The lean image is the right extension point β it contains pinned production dependencies from requirements/base.txt .
3. pyproject.toml optional extras (outside Docker)
For non-Docker installs, use pip install "apache-superset[postgres,mysql]". The full list of 40+ optional extras (BigQuery, Snowflake, Trino, etc.) is defined in pyproject.toml.
Key Files Reference#
| Path | Role |
|---|---|
Dockerfile | Multi-stage build definition |
docker/pip-install.sh | uv pip install wrapper used in all Python stages |
docker/docker-bootstrap.sh | Container startup: local overrides, service routing |
docker/entrypoints/run-server.sh | Production Gunicorn entrypoint |
docker/entrypoints/docker-ci.sh | CI entrypoint (extends run-server.sh) |
docker-compose.yml | Dev compose (live reload, SUPERSET_BUILD_TARGET variable) |
docker-compose-non-dev.yml | Immutable local build, Gunicorn mode |
docker-compose-image-tag.yml | Uses pre-built Docker Hub images |