python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt -r requirements-dev.txt
pytest -q
uvicorn app.main:app --reload# Run tests during build (multi-stage target)
docker build --target test -t fastapi-starter:test .
# Build runtime image
docker build --target runtime -t fastapi-starter:latest .
# Run
docker run --rm -p 8000:8000 fastapi-starter:latestWorkflow: .github/workflows/ci.yml
- PRs: build
teststage (runs pytest) - main branch pushes: build
runtimestage and push toghcr.io/<owner>/<repo>
To pull after push:
docker pull ghcr.io/<owner>/<repo>:latestEnsure your repo has Packages enabled. The workflow uses
secrets.GITHUB_TOKEN.
Docs live in /docs. Workflow: .github/workflows/pages.yml
In GitHub:
- Settings → Pages
- Source: GitHub Actions
Install act, then:
# Run the CI workflow locally
act -W .github/workflows/ci.yml
# Run pages build locally (deploy step is skipped unless you provide tokens)
act -W .github/workflows/pages.ymlIf you use Apple Silicon and hit platform issues:
act --container-architecture linux/amd64 -W .github/workflows/ci.yml