File size: 1,135 Bytes
f8cd885
 
34ab7d8
f8cd885
34ab7d8
 
 
 
 
 
 
 
 
 
f8cd885
 
 
 
 
 
 
 
 
 
aecfcba
f8cd885
34ab7d8
 
 
 
 
 
f8cd885
34ab7d8
 
 
 
 
 
 
 
f8cd885
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
FROM node:20-slim

# Install dependencies
RUN apt update && apt install -y \
    wget \
    curl \
    ca-certificates \
    gnupg \
    xvfb \
    && 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 update && apt install -y google-chrome-stable \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

RUN mkdir -p /app/data

COPY package*.json ./
RUN npm install

COPY . .

EXPOSE 7860

# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=30s --retries=3 \
    CMD curl -f http://localhost:7860/health || exit 1

# Start command - run test.js first, then index.js
CMD Xvfb :99 -screen 0 1024x768x16 & \
    export DISPLAY=:99 && \
    sleep 5 && \
    echo "Running test.js to create session..." && \
    if [ -f "test.js" ]; then \
        node test.js || echo "test.js completed (exit code: $?)"; \
    else \
        echo "test.js not found, skipping..."; \
    fi && \
    echo "Starting main bot..." && \
    node index.js