molehh's picture
modified docker file
ca86d8f
raw
history blame
737 Bytes
# 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
# 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"]