molehh's picture
modified docker file
159fc5c
raw
history blame
656 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"]