testing / Dockerfile
Danielsz's picture
deploy
16e8be2
Raw
History Blame Contribute Delete
1.03 kB
# Usa la imagen oficial ligera de Python 3.11
FROM python:3.11-slim
# Instala dependencias del sistema requeridas para psycopg2 y otros
RUN apt-get update && apt-get install -y \
libpq-dev \
gcc \
git \
ffmpeg \
libsndfile1 \
&& rm -rf /var/lib/apt/lists/*
# Establece el directorio de trabajo
WORKDIR /app
# Copia e instala las dependencias de Python
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
# Copia el proyecto al contenedor
COPY . /app/
# Otorga permisos de ejecución (Hugging Face ejecuta la app como un usuario normal)
RUN chmod -R 777 /app
# Expone el puerto 7860, que es el que requiere Hugging Face Spaces
EXPOSE 7860
# Configura variables de entorno para evitar que Python escriba archivos pyc y enviar output al terminal
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Ejecutar migraciones y encender el servidor Gunicorn
CMD ["sh", "-c", "python manage.py migrate && gunicorn config.wsgi:application --bind 0.0.0.0:7860 --timeout 300"]