| FROM python:3.12 | |
| # Run as root to install system packages and setup sudo | |
| USER root | |
| # Install standard Dev Mode dependencies and sudo | |
| RUN apt-get update && apt-get install -y \ | |
| bash curl wget procps git git-lfs sudo \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create the user and add to sudoers with no password requirement | |
| RUN useradd -m -u 1000 user \ | |
| && usermod -aG sudo user \ | |
| && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | |
| # Switch back to the non-root user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| # Copy files and install python dependencies | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| COPY --chown=user . /app | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |