Fourstore commited on
Commit
34ab7d8
·
verified ·
1 Parent(s): aecfcba

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -8
Dockerfile CHANGED
@@ -1,12 +1,17 @@
1
  FROM node:20-slim
2
 
 
3
  RUN apt update && apt install -y \
4
- wget gnupg ca-certificates xvfb curl \
5
- fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 \
6
- libatk1.0-0 libxss1 libnss3 libxcomposite1 libxdamage1 libxrandr2 libgbm1 \
7
- && wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
8
- && apt install -y ./google-chrome-stable_current_amd64.deb \
9
- && rm google-chrome-stable_current_amd64.deb
 
 
 
 
10
 
11
  WORKDIR /app
12
 
@@ -19,7 +24,19 @@ COPY . .
19
 
20
  EXPOSE 7860
21
 
22
- CMD rm -f /tmp/.X99-lock && \
23
- Xvfb :99 -screen 0 1024x768x24 & \
 
 
 
 
24
  export DISPLAY=:99 && \
 
 
 
 
 
 
 
 
25
  node index.js
 
1
  FROM node:20-slim
2
 
3
+ # Install dependencies
4
  RUN apt update && apt install -y \
5
+ wget \
6
+ curl \
7
+ ca-certificates \
8
+ gnupg \
9
+ xvfb \
10
+ && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
11
+ && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \
12
+ && apt update && apt install -y google-chrome-stable \
13
+ && apt-get clean \
14
+ && rm -rf /var/lib/apt/lists/*
15
 
16
  WORKDIR /app
17
 
 
24
 
25
  EXPOSE 7860
26
 
27
+ # Health check
28
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=30s --retries=3 \
29
+ CMD curl -f http://localhost:7860/health || exit 1
30
+
31
+ # Start command - run test.js first, then index.js
32
+ CMD Xvfb :99 -screen 0 1024x768x16 & \
33
  export DISPLAY=:99 && \
34
+ sleep 5 && \
35
+ echo "Running test.js to create session..." && \
36
+ if [ -f "test.js" ]; then \
37
+ node test.js || echo "test.js completed (exit code: $?)"; \
38
+ else \
39
+ echo "test.js not found, skipping..."; \
40
+ fi && \
41
+ echo "Starting main bot..." && \
42
  node index.js