All checks were successful
Workflow de prueba / Build and push images (push) Successful in 1m8s
51 lines
1.1 KiB
Docker
51 lines
1.1 KiB
Docker
# ---------------------------
|
|
# Builder stage
|
|
# ---------------------------
|
|
FROM python:3.13-bookworm AS builder
|
|
|
|
# Solo herramientas necesarias para compilar dependencias
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential && apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
ADD https://astral.sh/uv/install.sh /install.sh
|
|
RUN chmod -R 655 /install.sh && /install.sh && rm /install.sh
|
|
|
|
ENV PATH="/root/.local/bin:$PATH"
|
|
|
|
WORKDIR /app
|
|
|
|
# Copiamos solo archivos de dependencias (mejor cache)
|
|
COPY pyproject.toml ./
|
|
|
|
# Cambiamos pip por uv más moderno y rápido
|
|
RUN uv sync
|
|
|
|
# ---------------------------
|
|
# Runtime stage
|
|
# ---------------------------
|
|
FROM python:3.13-slim-bookworm AS production
|
|
|
|
|
|
ENV BASIC_AUTH_USERNAME=admin
|
|
ENV BASIC_AUTH_PASSWORD=admin
|
|
|
|
WORKDIR /app
|
|
|
|
# Crear usuario no-root
|
|
RUN useradd --create-home appuser
|
|
|
|
# Copiamos código y producto uv
|
|
|
|
COPY . .
|
|
COPY --from=builder /app/.venv .venv
|
|
|
|
# Cambiar permisos
|
|
#RUN chown -R appuser:appuser /app
|
|
|
|
#USER appuser
|
|
ENV PATH="/app/.venv/bin:$PATH"
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["uvicorn", "beyond_api.main:app", "--host", "0.0.0.0", "--port", "8000"]
|