Nuevos cambios en el servidor
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
# FastAPI Backend Dockerfile
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Instalar dependencias del sistema
|
||||
@@ -8,13 +7,20 @@ RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Configurar directorio de trabajo
|
||||
# Directorio de trabajo y PYTHONPATH
|
||||
WORKDIR /app
|
||||
ENV PYTHONPATH=/app
|
||||
|
||||
# Copiar requirements y instalar dependencias Python
|
||||
COPY requirements.txt .
|
||||
# Instalar dependencias Python
|
||||
COPY backend/requirements.txt requirements.txt
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copiar todo el contenido del directorio backend
|
||||
COPY backend /app/backend
|
||||
|
||||
# Copiar el script de migraciones
|
||||
COPY backend/run_sync_migrations.py /app/backend/run_sync_migrations.py
|
||||
|
||||
# Crear usuario no root
|
||||
RUN useradd --create-home --shell /bin/bash app \
|
||||
&& chown -R app:app /app
|
||||
@@ -23,9 +29,6 @@ RUN useradd --create-home --shell /bin/bash app \
|
||||
RUN mkdir -p /app/uploads /app/logs \
|
||||
&& chown -R app:app /app/uploads /app/logs
|
||||
|
||||
# Copiar código de la aplicación
|
||||
COPY . .
|
||||
|
||||
# Cambiar permisos
|
||||
RUN chown -R app:app /app
|
||||
|
||||
@@ -35,9 +38,9 @@ USER app
|
||||
# Exponer puerto
|
||||
EXPOSE 8000
|
||||
|
||||
# Health check
|
||||
# Healthcheck
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
||||
CMD curl -f http://localhost:8000/health || exit 1
|
||||
|
||||
# Comando por defecto
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
||||
# CMD por defecto
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
||||
|
||||
Reference in New Issue
Block a user