39 lines
1.0 KiB
Docker
39 lines
1.0 KiB
Docker
# 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
|
|
|
|
# Nota: Este servicio ahora sirve tanto la API REST como la UI HTMX (Opción A)
|
|
|
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=15s --retries=3 \
|
|
CMD curl -fsS http://localhost:8000/health || exit 1
|
|
|
|
CMD ["uvicorn", "forja_core.main:app", "--host", "0.0.0.0", "--port", "8000"]
|