build: añade Dockerfiles para core y dashboard con healthchecks y usuario no-root
- core/Dockerfile: python:3.11-slim, instala requirements + modelo spaCy (en_core_web_sm para Presidio), corre como usuario `agent`, HEALTHCHECK sobre /health, CMD uvicorn :8000. - dashboard/Dockerfile: python:3.11-slim, usuario `dash`, HEALTHCHECK sobre /_stcore/health, CMD streamlit :8501 headless. - .dockerignore: excluye venv, caches, datos runtime, .env, specs/plans y tests. Ambos pasan `docker build --check` sin warnings. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
.git
|
||||
.venv
|
||||
.pytest_cache
|
||||
.mypy_cache
|
||||
.ruff_cache
|
||||
__pycache__
|
||||
*.pyc
|
||||
data/*.sqlite
|
||||
data/*.jsonl
|
||||
.env
|
||||
.env.local
|
||||
docs/superpowers/specs
|
||||
docs/superpowers/plans
|
||||
tests
|
||||
@@ -0,0 +1,36 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
|
||||
FROM python:3.11-slim AS base
|
||||
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Dependencias del sistema (Presidio necesita libpangocairo / spacy modelos)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY core/requirements.txt /app/requirements.txt
|
||||
RUN pip install -r /app/requirements.txt
|
||||
|
||||
# Modelo de spaCy requerido por Presidio (en idioma `en`)
|
||||
RUN python -m spacy download en_core_web_sm
|
||||
|
||||
COPY core/src /app/src
|
||||
ENV PYTHONPATH=/app/src
|
||||
|
||||
# Usuario no-root
|
||||
RUN useradd --create-home --shell /bin/bash agent && chown -R agent:agent /app
|
||||
USER agent
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
HEALTHCHECK --interval=10s --timeout=3s --start-period=15s --retries=3 \
|
||||
CMD curl -fsS http://localhost:8000/health || exit 1
|
||||
|
||||
CMD ["uvicorn", "agentforge_core.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
@@ -0,0 +1,31 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
|
||||
FROM python:3.11-slim
|
||||
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY dashboard/requirements.txt /app/requirements.txt
|
||||
RUN pip install -r /app/requirements.txt
|
||||
|
||||
COPY dashboard/src /app/src
|
||||
ENV PYTHONPATH=/app/src
|
||||
|
||||
RUN useradd --create-home --shell /bin/bash dash && chown -R dash:dash /app
|
||||
USER dash
|
||||
|
||||
EXPOSE 8501
|
||||
|
||||
HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=3 \
|
||||
CMD curl -fsS http://localhost:8501/_stcore/health || exit 1
|
||||
|
||||
CMD ["streamlit", "run", "/app/src/agentforge_dashboard/app.py", \
|
||||
"--server.address=0.0.0.0", "--server.port=8501", \
|
||||
"--server.headless=true", "--browser.gatherUsageStats=false"]
|
||||
Reference in New Issue
Block a user