- Dockerfile: python:3.12-slim + uv --frozen, no root, HEALTHCHECK sobre /api/health, un worker con --proxy-headers para el Traefik de Coolify - HEAD explícito en /api/health y /api/export (curl -I del criterio 12; export HEAD devuelve el Content-Length exacto sin generar audio) - PWA: manifest, iconos generados con numpy+stdlib, apple-touch-icon - docker-compose.dev.yml (solo local), .dockerignore - deploy/coolify.md: recurso, deploy key, webhook Gitea, dominio, volumen - versión 0.2.0 · smoke test del contenedor en local: healthy
39 lines
1.3 KiB
Docker
39 lines
1.3 KiB
Docker
# Imagen de producción · la construye Coolify (build pack: Dockerfile)
|
|
FROM python:3.12-slim
|
|
|
|
COPY --from=ghcr.io/astral-sh/uv:0.10.6 /uv /uvx /usr/local/bin/
|
|
|
|
# libsndfile por si la wheel de soundfile no trae la suya
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends libsndfile1 \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& useradd --create-home app
|
|
|
|
ENV UV_LINK_MODE=copy \
|
|
UV_PYTHON_DOWNLOADS=never \
|
|
UV_COMPILE_BYTECODE=1 \
|
|
BINAURAL_CACHE_DIR=/data/cache
|
|
|
|
# Capa de dependencias (cacheable): solo lockfile y metadatos
|
|
WORKDIR /app/backend
|
|
COPY backend/pyproject.toml backend/uv.lock ./
|
|
RUN uv sync --frozen --no-dev --no-install-project
|
|
|
|
# Código y frontend
|
|
COPY backend /app/backend
|
|
COPY web /app/web
|
|
RUN uv sync --frozen --no-dev \
|
|
&& mkdir -p /data/cache \
|
|
&& chown -R app:app /data /app
|
|
|
|
USER app
|
|
EXPOSE 8000
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
|
CMD ["python", "-c", "import urllib.request,sys; r=urllib.request.urlopen('http://127.0.0.1:8000/api/health', timeout=4); sys.exit(0 if r.status==200 else 1)"]
|
|
|
|
# Un solo worker (1 vCPU compartida); proxy-headers para el Traefik de Coolify
|
|
CMD ["/app/backend/.venv/bin/uvicorn", "binaural.api:app", \
|
|
"--host", "0.0.0.0", "--port", "8000", \
|
|
"--proxy-headers", "--forwarded-allow-ips=*"]
|