Run Rediflow with Podman or Docker

This howto gets the build artefact (container image) and database running using the Dockerfile and compose file, with optional Makefile targets.

Both Podman and Docker are supported. Use make DOCKER=1 build and make DOCKER=1 up for Docker. The compose files work with either runtime.

What you need

  • Podman (rootless or root) with Compose: either podman-compose or Podman 4.1+ with built-in podman compose.
  • One compose file (compose.yml) defines:
    • db: PostgreSQL 18 (Alpine), persistent volume, healthcheck.
    • app (profile dev): Flask dev server, built from Dockerfile.
    • app-qa (profile qa): Gunicorn WSGI, same image.

No extra compose files are required; profiles select which app mode runs.

One-time setup

  1. Env files (so the app and compose know DB credentials and app settings):

    • Copy .env.dev.example.env.dev (and optionally .env.qa.example.env.qa for QA).
    • Create .env with POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DB matching .env.dev (or .env.qa for QA). Compose loads .env by default and uses these to build DATABASE_URL for the app container.
    • When running inside compose, DATABASE_URL host is overridden to db by compose; you only need correct POSTGRES_* / DATABASE_URL for the values used in compose.yml.
  2. Build the image (build artefact):

    make build
    

    Or without Make: podman compose build. This produces the image rediflow:latest used by both dev and QA services.

Run app + database

  • Dev (Flask):

    make up
    

    Or: podman compose up -d db app. App at http://localhost:5000.

  • QA (Gunicorn):

    make up-qa
    

    Or: podman compose up -d db app-qa.

  • Database only (run app on host, DB in container):

    make up-db
    

    Uses compose.db-only.yml so only PostgreSQL starts. Then set DATABASE_URL=postgresql://rediflow:rediflow@localhost:5432/rediflow in .env.dev and run uv run rediflow run (or similar) on the host.

Note: Podman Compose with --profile support is required for migrate scripts and dev/qa profile. The Makefile uses service names (db, app, app-qa) for up.

Migrations

After the database is up (via make up-db or make up / make up-qa), run:

make migrate

This runs a one-off rediflow:latest container on the same network as the db (using podman run), so it works whether the db was started with compose.db-only.yml or compose.yml.

Stop

make down

Stops app (if started with dev/qa profile) and the database.

Using Docker instead of Podman

Both Podman and Docker are fully supported. Set DOCKER=1 so the Makefile uses docker compose:

make DOCKER=1 build
make DOCKER=1 up

The same compose files and Dockerfile work with either runtime.

Summary: do we need more than compose files?

  • compose.yml defines DB + app (dev) + app-qa (qa). Use up -d db app or up -d db app-qa to start the stack you need.
  • compose.db-only.yml defines only the DB (same image and volume); used by make up-db so only PostgreSQL runs.
  • Dockerfile builds the single app image rediflow:latest used by both app services.
  • Makefile gives a single entry point: make build, make up, make migrate, make down. Migrate uses podman run so it works with either compose file.

The build artefact is the image rediflow:latest; the database uses the named volume rediflow_pgdata.

For QA or production using the pre-built image from the registry (no local build), see Deploy QA and production.