-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
26 lines (20 loc) · 816 Bytes
/
Dockerfile
File metadata and controls
26 lines (20 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 1. Usamos una imagen base ligera de Python
FROM python:3.11-slim
# 2. Evita que Python genere archivos .pyc y fuerza logs en tiempo real
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# 3. Directorio de trabajo dentro del contenedor
WORKDIR /app
# 4. Instalar dependencias del sistema necesarias para Postgres
RUN apt-get update \
&& apt-get install -y --no-install-recommends gcc libpq-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# 5. Copiar y ejecutar requirements primero
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 6. Copiamos todo el código del proyecto
COPY . .
# 7. Comando para arrancar la API
# Usamos 0.0.0.0 para que sea accesible desde fuera del contenedor
CMD alembic upgrade head && uvicorn app.main:app --host 0.0.0.0 --port 8000