| # Use Python base image | |
| FROM python:3.12.2 | |
| # Add a new user but do not switch yet | |
| RUN useradd -m -u 1000 user | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy application code with correct ownership | |
| COPY --chown=user . /app/ | |
| USER root | |
| COPY requirements.txt requirements.txt | |
| RUN apt-get update && apt-get install git -y | |
| RUN pip3 install -r requirements.txt | |
| RUN pip3 install "git+https://github.com/openai/whisper.git" | |
| RUN apt-get update && apt-get install -y ffmpeg | |
| COPY . . | |
| # Expose port | |
| EXPOSE 7860 | |
| # Start the FastAPI application | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |