Team Ai
Apppublic

ShihadShowkat/ui_to_code

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
Dockerfile41 linesDownload Raw Back to root
1# 1. Use an official, lightweight Python base image2FROM python:3.11-slim3 4# 2. Set environment variables to optimize Python within Docker containers5ENV PYTHONUNBUFFERED=1 \6    PYTHONDONTWRITEBYTECODE=1 \7    HOME=/home/user \8    PATH=/home/user/.local/bin:$PATH9 10# 3. Install low-level system essentials required for image handling (Pillow)11RUN apt-get update && apt-get install -y --no-install-recommends \12    build-essential \13    libgl1 \14    libglx0 \15    libglib2.0-0 \16    git \17    && rm -rf /var/lib/apt/lists/*18 19# 4. Set up a secure, non-root user matching Hugging Face container defaults20RUN useradd -m -u 1000 user21WORKDIR /code22 23# 5. Copy the requirements file and change ownership to the non-root user24COPY --chown=user:user requirements.txt /code/requirements.txt25 26# 6. Switch context to the non-root user before running package installations27USER user28 29# 7. Upgrade pip and install dependencies using the CPU-only package configurations30RUN pip install --no-cache-dir --upgrade pip && \31    pip install --no-cache-dir -r requirements.txt32 33# 8. Copy the rest of your application code into the working directory34COPY --chown=user:user . /code35 36# 9. Inform the Hugging Face orchestrator which network port the application binds to37EXPOSE 786038 39# 10. Launch Uvicorn, binding explicitly to 0.0.0.0 on Hugging Face's standard port 786040CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]41