File size: 2,160 Bytes
0821095
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bec56ba
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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"]