Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ frontend/release/
# Local Claude Code instructions
CLAUDE.md

*temp/
*temp/
*.env*
27 changes: 27 additions & 0 deletions docker/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copy this file to .env.dev or .env.prod and fill in values.
# Never commit .env.dev or .env.prod — they are gitignored.

# --- App ------------------------------------------------------------------
APP_PORT=8000

# --- Ollama ---------------------------------------------------------------
# Ollama runs in Docker with port mapped to host. App runs on host.
# Override to point at an external Ollama instance (e.g. a GPU server).
OLLAMA_HOST=http://localhost:11434
OLLAMA_MODEL=qwen2.5:1.5b
OLLAMA_TIMEOUT=300

# --- Whisper --------------------------------------------------------------
# Whisper runs in Docker with port mapped to host. App runs on host.
# Override to point at an external Whisper endpoint.
WHISPER_HOST=http://localhost:9000
WHISPER_MODEL=small.en

# --- Gunicorn (prod only) -------------------------------------------------
GUNICORN_WORKERS=2

# --- CORS -----------------------------------------------------------------
# Comma-separated list of allowed frontend origins.
# Dev: http://localhost:5173,http://127.0.0.1:5173
# Prod: https://your-domain.com
FRONTEND_ORIGINS=http://localhost:5173,http://127.0.0.1:5173
31 changes: 31 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Docker

```
docker/
dev/
Dockerfile # uvicorn --reload, source-mounted for hot reload
compose.yml
prod/
Dockerfile # multi-stage build, gunicorn, no source mount
compose.yml
.env.example # template — copy to .env.dev or .env.prod
.env.dev # gitignored, dev values
.env.prod # gitignored, prod values
entrypoint.sh # runs DB migrations then exec's the server command
README.md
```

## Env vars

See `.env.example` for the full list with descriptions.

## Volumes

`docker compose down` never removes volumes. Use `docker compose down -v` only to intentionally wipe all data.

| Volume | Path in container | Purpose |
| ------------------ | ---------------------- | ----------------------------------- |
| `fireform_db` | `/data/db/fireform.db` | SQLite database |
| `fireform_uploads` | `/data/uploads` | Uploaded templates + generated PDFs |
| `ollama_data` | `/root/.ollama` | Ollama model weights |
| `whisper_models` | `/data/whisper` | Whisper model cache |
1 change: 1 addition & 0 deletions docker/dev/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ services:
condition: service_healthy
whisper:
condition: service_started
entrypoint: ["sh", "docker/entrypoint.sh"]
command: ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
volumes:
- ../..:/app
Expand Down
10 changes: 10 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -e

# Ensure data directories exist (volumes may be empty on first run)
mkdir -p /data/db /data/uploads

# Run DB migrations / init before starting the server
python3 -m app.db.init_db

exec "$@"
2 changes: 2 additions & 0 deletions docker/prod/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ COPY --from=builder /install /usr/local
# Copy only app code, not data/ temp/ tests/ docs/ etc.
COPY app/ ./app/
COPY requirements.txt .
COPY docker/entrypoint.sh /entrypoint.sh

ENV PYTHONPATH=/app

Expand All @@ -30,6 +31,7 @@ RUN mkdir -p /data/db /data/uploads && chmod +x /entrypoint.sh

EXPOSE 8000

ENTRYPOINT ["/entrypoint.sh"]
CMD ["gunicorn", "app.main:app", \
"--worker-class", "uvicorn.workers.UvicornWorker", \
"--bind", "0.0.0.0:8000", \
Expand Down
Loading