| # Use an official Python runtime as a parent image | |
| FROM python:3.9 | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| # Install dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Expose the ports for FastAPI (8000) and Streamlit (8501) | |
| COPY --chown=user . /app | |
| # Run FastAPI and Streamlit in parallel | |
| CMD ["uvicorn" ,"api.main:app","--host" ,"0.0.0.0", "--port", "7860"] | |