FROM python:3.10-slim WORKDIR /app # Create non-root user RUN useradd -m -u 1000 user # Install system dependencies RUN apt-get update && apt-get install -y \ netcat-openbsd \ wget \ gnupg \ curl \ libnss3 \ libnspr4 \ libatk1.0-0 \ libatk-bridge2.0-0 \ libcups2 \ libdrm2 \ libdbus-1-3 \ libxkbcommon0 \ libx11-6 \ libxcomposite1 \ libxdamage1 \ libxext6 \ libxfixes3 \ libxrandr2 \ libgbm1 \ libpango-1.0-0 \ libcairo2 \ libasound2 \ libatspi2.0-0 \ unzip \ xvfb \ libglib2.0-0 \ && pip install --upgrade pip \ && pip install poetry # Install Chrome - required for Helium RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \ && apt-get update \ && apt-get install -y google-chrome-stable \ && rm -rf /var/lib/apt/lists/* # Configure environment variables for Chrome ENV CHROMEDRIVER_PATH=/usr/bin/chromedriver \ CHROME_PATH=/usr/bin/google-chrome-stable \ CHROME_BIN=/usr/bin/google-chrome-stable # Copy application files COPY . /app/ # Install Python dependencies RUN poetry config virtualenvs.create false \ && poetry install --no-interaction --no-ansi # Environment variables ENV API_HOST=0.0.0.0 \ API_PORT=7860 \ PYTHONPATH=/app \ DISPLAY=:99 \ PYTHONUNBUFFERED=1 \ SELENIUM_DRIVER_EXECUTABLE_PATH=/usr/bin/chromedriver \ LEADERBOARD_REPROCESS_INTERVAL_HOURS=24 \ HOME=/home/user # Create cache directory and set permissions RUN mkdir -p /app/cache /home/user/.cache && chown -R user:user /app/cache /app/ /home/user/.cache # Install additional fonts RUN apt-get update && apt-get install -y \ fonts-noto-color-emoji \ fonts-freefont-ttf \ libharfbuzz-icu0 \ && rm -rf /var/lib/apt/lists/* # Switch to non-root user USER user EXPOSE 7860 # Default startup command for server mode with periodic processing # This is overridden by Docker Compose CMD ["python", "main.py", "--server", "--ignore-cooldown"]