CoolFace
Apppublic

Bishall10/ipo

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
Dockerfile64 linesDownload Raw Back to root
1# Use an official Python runtime as a parent image2FROM python:3.11-slim3 4# Set environment variables5ENV PYTHONDONTWRITEBYTECODE 16ENV PYTHONUNBUFFERED 17ENV PLAYWRIGHT_BROWSERS_PATH=/usr/local/bin/playwright-browsers8 9# Install system dependencies10RUN apt-get update && apt-get install -y \11    libpq-dev \12    gcc \13    curl \14    gnupg \15    && rm -rf /var/lib/apt/lists/*16 17# Install Playwright system dependencies18RUN apt-get update && apt-get install -y \19    libnss3 \20    libnspr4 \21    libatk1.0-0 \22    libatk-bridge2.0-0 \23    libcups2 \24    libdrm2 \25    libdbus-1-3 \26    libxcb1 \27    libxkbcommon0 \28    libx11-6 \29    libxcomposite1 \30    libxdamage1 \31    libxext6 \32    libxfixes3 \33    libxrandr2 \34    libgbm1 \35    libpango-1.0-0 \36    libcairo2 \37    libasound2 \38    && rm -rf /var/lib/apt/lists/*39 40# Create a non-root user41RUN useradd -m -u 1000 user42WORKDIR /app43 44# Install Python dependencies45COPY requirements_hf.txt .46RUN pip install --no-cache-dir -r requirements_hf.txt47 48# Install Playwright browsers49RUN playwright install chromium50RUN playwright install-deps chromium51 52# Copy project files53COPY --chown=user:user . .54 55# Set permissions for the non-root user56RUN chown -R user:user /app57USER user58 59# Expose port (Hugging Face Spaces use 7860)60EXPOSE 786061 62# Start the application with verbose output for debugging63CMD ["sh", "-c", "echo 'Running migrations...' && python manage.py migrate --noinput && echo 'Starting Gunicorn...' && gunicorn config.wsgi:application --bind 0.0.0.0:7860 --workers 1 --threads 4 --timeout 120 --access-logfile - --error-logfile -"]64