adds devcontainer with docker

This commit is contained in:
2026-06-14 18:53:28 +00:00
parent 5f0d8511d2
commit b41371944d
3 changed files with 40 additions and 2 deletions
+10 -1
View File
@@ -2,8 +2,17 @@ FROM python:3.11-slim
# Dev tools — not needed in production, but essential for development # Dev tools — not needed in production, but essential for development
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
git \ ca-certificates \
curl \ curl \
gnupg \
&& install -m 0755 -d /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.asc \
&& chmod a+r /etc/apt/keyrings/docker.asc \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update && apt-get install -y --no-install-recommends \
docker-ce-cli \
git \
ffmpeg \ ffmpeg \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
+2 -1
View File
@@ -1,7 +1,8 @@
{ {
"name": "Guardian Newscast Pipeline", "name": "Guardian Newscast Pipeline",
"build": { "build": {
"dockerfile": "Dockerfile" "dockerfile": "Dockerfile",
"context": ".."
}, },
"forwardPorts": [8080], "forwardPorts": [8080],
"portsAttributes": { "portsAttributes": {
+28
View File
@@ -54,6 +54,34 @@ Each stage reads the previous stage's output file. Stages are independent and ca
- Concurrent processing with `asyncio.Semaphore(CONCURRENCY_LIMIT=1)`. - Concurrent processing with `asyncio.Semaphore(CONCURRENCY_LIMIT=1)`.
- Cleans up intermediate WAV files after conversion. - Cleans up intermediate WAV files after conversion.
### DevContainer (`.devcontainer/`)
A VS Code Dev Container enables reproducible development. Two files define it:
- **`Dockerfile`** (based on `python:3.11-slim`):
- Installs system deps: `git`, `curl`, `ffmpeg`.
- Copies and installs `requirements.txt` (project root) into the container at `/app/`.
- Sets default env vars: `OLLAMA_URL`, `MODEL_NAME`, `PORT`, `POLL_INTERVAL`, `DATA_DIR`, `TTS_VOICE`.
- Creates `/app/data/audio/` for output.
- **`devcontainer.json`**:
- Points VS Code to the Dockerfile.
- Forwards port `8080` (newscast API).
- `postCreateCommand`: runs `pip install -r requirements.txt` in the VS Code Python interpreter for IDE features (linting, completions).
- `remoteEnv`: overrides Dockerfile defaults with workspace-relative values (e.g., `DATA_DIR` points to `${workspaceFolder}/data`).
- Extensions: `ms-python.python`, `ms-python.vscode-pylance`.
**Key env vars** (Dockerfile defaults, overridable via `devcontainer.json` `remoteEnv`):
| Variable | Default | Description |
|---|---|---|
| `OLLAMA_URL` | `http://host.docker.internal:11434/api/generate` | Ollama API endpoint (use `host.docker.internal` to reach host from container) |
| `MODEL_NAME` | `gemma4:e2b` | Ollama model identifier |
| `PORT` | `8080` | Newscast API listen port |
| `POLL_INTERVAL` | `21600` | API polling interval in seconds (6 hours) |
| `DATA_DIR` | `/app/data` | Base directory for all pipeline output files |
| `TTS_VOICE` | `af_heart` | Kokoro TTS voice |
## Common Tasks ## Common Tasks
### Add a New Pipeline Stage ### Add a New Pipeline Stage