Spaces:
Running
Running
feat: Day 9 — Docker deployment with Dockerfile and docker-compose
Browse files- Dockerfile: python:3.11-slim, copies source before pip install,
pre-downloads embedding model and runs ingestion at build time
- docker-compose.yaml: maps port 8000, passes OPENAI_API_KEY,
mounts .cache volume for embedding persistence
- .dockerignore: excludes tests, docs, .git, caches from build context
Docker daemon not running in this environment — build not verified.
Dockerfile follows design spec exactly (copy-before-install pattern).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- .dockerignore +23 -0
- docker/Dockerfile +20 -0
- docker/docker-compose.yaml +12 -0
.dockerignore
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
*.py[cod]
|
| 3 |
+
*.egg-info/
|
| 4 |
+
dist/
|
| 5 |
+
build/
|
| 6 |
+
.eggs/
|
| 7 |
+
.cache/
|
| 8 |
+
.mypy_cache/
|
| 9 |
+
.pytest_cache/
|
| 10 |
+
.ruff_cache/
|
| 11 |
+
.git/
|
| 12 |
+
.github/
|
| 13 |
+
.venv/
|
| 14 |
+
venv/
|
| 15 |
+
tests/
|
| 16 |
+
docs/
|
| 17 |
+
docker/
|
| 18 |
+
*.md
|
| 19 |
+
!data/**/*.md
|
| 20 |
+
.env
|
| 21 |
+
.gitignore
|
| 22 |
+
.dockerignore
|
| 23 |
+
Makefile
|
docker/Dockerfile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
WORKDIR /app
|
| 3 |
+
|
| 4 |
+
# Copy all source before pip install (package needs agent_bench/ to build)
|
| 5 |
+
COPY pyproject.toml .
|
| 6 |
+
COPY agent_bench/ agent_bench/
|
| 7 |
+
COPY configs/ configs/
|
| 8 |
+
COPY data/ data/
|
| 9 |
+
COPY scripts/ scripts/
|
| 10 |
+
|
| 11 |
+
RUN pip install --no-cache-dir .
|
| 12 |
+
|
| 13 |
+
# Pre-download embedding model at build time
|
| 14 |
+
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
|
| 15 |
+
|
| 16 |
+
# Run ingestion at build time so the store is ready
|
| 17 |
+
RUN python scripts/ingest.py --doc-dir data/tech_docs/ --store-path .cache/store
|
| 18 |
+
|
| 19 |
+
EXPOSE 8000
|
| 20 |
+
CMD ["uvicorn", "agent_bench.serving.app:create_app", "--factory", "--host", "0.0.0.0", "--port", "8000"]
|
docker/docker-compose.yaml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: "3.8"
|
| 2 |
+
services:
|
| 3 |
+
agent-bench:
|
| 4 |
+
build:
|
| 5 |
+
context: ..
|
| 6 |
+
dockerfile: docker/Dockerfile
|
| 7 |
+
ports:
|
| 8 |
+
- "8000:8000"
|
| 9 |
+
environment:
|
| 10 |
+
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
| 11 |
+
volumes:
|
| 12 |
+
- ../.cache:/app/.cache
|