diamond-in/Replicate-1
0
1FROM python:3.9-slim2 3# 1. Install sudo and basic system tools4# We do this as actual root during the build process5RUN apt-get update && apt-get install -y \6 sudo \7 curl \8 wget \9 git \10 procps \11 && rm -rf /var/lib/apt/lists/*12 13# 2. Setup the Hugging Face user (ID 1000)14RUN useradd -m -u 1000 user15 16# 3. THE MAGIC SAUCE: Grant Real Root permissions17# This line adds 'user' to sudoers and disables the password requirement18RUN echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers19 20# 4. Set up environment21USER user22ENV HOME=/home/user \23 PATH=/home/user/.local/bin:$PATH24 25WORKDIR /home/user/app26 27# 5. Install Python Dependencies28COPY --chown=user requirements.txt .29RUN pip install --no-cache-dir -r requirements.txt30 31# 6. Copy App32COPY --chown=user . .33 34# 7. Run FastAPI35CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]