hammaster/cutoutai
0
1# Use NVIDIA CUDA base image if possible, otherwise standard python2FROM python:3.10-slim3 4# Set environment variables5ENV PYTHONDONTWRITEBYTECODE=16ENV PYTHONUNBUFFERED=17ENV TRANSFORMERS_CACHE=/app/cache8ENV MPLCONFIGDIR=/app/cache9ENV HOME=/home/user10 11# Install system dependencies12RUN apt-get update && apt-get install -y build-essential libgl1 libglib2.0-0 && rm -rf /var/lib/apt/lists/*13 14# Set up a new user named "user" with UID 100015RUN useradd -m -u 1000 user16 17# Create app directory18WORKDIR /app19 20# Install dependencies21COPY requirements.txt .22RUN pip install --no-cache-dir -r requirements.txt23 24# Create cache directory with right permissions25RUN mkdir -p /app/cache && chmod 777 /app/cache26 27# Switch to the "user" user28USER user29 30# Set home to /home/user31ENV HOME=/home/user32ENV PATH=/home/user/.local/bin:$PATH33 34# Copy app code (owned by user)35COPY --chown=user . .36 37# Expose port (HuggingFace default is 7860)38EXPOSE 786039 40# Start command41# We use uvicorn to run the FastAPI app on port 786042CMD ["python", "api.py", "--port", "7860"]43 