feat(deploy): add Dockerfile and .dockerignore for AgentKit Server

- Multi-stage build (builder + runner) based on python:3.11-slim
- Installs .[server] extra (fastapi + uvicorn)
- Runs as non-root appuser
- Health check on /api/v1/health
- Default command: uvicorn configs.geo_server:create_geo_app --port 8001
This commit is contained in:
chiguyong 2026-06-05 23:18:44 +08:00
parent 133ae3927e
commit 47a848fbcb
2 changed files with 49 additions and 0 deletions

16
.dockerignore Normal file
View File

@ -0,0 +1,16 @@
.git
.gitignore
__pycache__/
*.pyc
*.pyo
.pytest_cache/
tests/
docs/
.coverage
*.egg-info/
dist/
build/
*.egg
.env
.env.*
!.env.example

33
Dockerfile Normal file
View File

@ -0,0 +1,33 @@
FROM python:3.11-slim AS builder
WORKDIR /app
COPY pyproject.toml README.md ./
COPY src/ ./src/
RUN pip install --no-cache-dir --prefix=/install ".[server]"
FROM python:3.11-slim AS runner
WORKDIR /app
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
COPY --from=builder /install /usr/local
COPY pyproject.toml README.md ./
COPY src/ ./src/
RUN addgroup --system --gid 1001 appuser \
&& adduser --system --uid 1001 appuser \
&& chown -R appuser:appuser /app
USER appuser
EXPOSE 8001
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8001/api/v1/health')"
CMD ["uvicorn", "configs.geo_server:create_geo_app", "--factory", "--host", "0.0.0.0", "--port", "8001"]