Spaces:
Sleeping
Sleeping
# # Use official Python image | |
# FROM python:3.9 | |
# # Create a non-root user for security | |
# RUN useradd -m -u 1000 user | |
# USER user | |
# # Set environment variables | |
# ENV PATH="/home/user/.local/bin:$PATH" | |
# # Set working directory | |
# WORKDIR /app | |
# # Copy dependency file first (for better caching) | |
# COPY --chown=user requirements.txt /app/requirements.txt | |
# # Install dependencies | |
# RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
# # Copy the rest of the application code | |
# COPY --chown=user . /app | |
# # Expose the port used by the application | |
# EXPOSE 7860 | |
FROM python:3.11 | |
WORKDIR /app | |
COPY . /app | |
RUN pip install --upgrade pip | |
RUN pip install -r requirements.txt | |
EXPOSE 7860 | |
# Ensure logs directory exists | |
RUN mkdir -p /app/logs && chmod -R 777 /app/logs | |
ENV PYTHONPATH="/app/src" | |
# Run the FastAPI app with Uvicorn | |
# CMD ["uvicorn", "src.backend.main:app", "--host", "0.0.0.0", "--port", "7860"] | |
CMD ["sh", "-c", "fastapi dev src/backend/main.py --host 0.0.0.0 --port 8000"] | |