NitinBot001 commited on
Commit
d82cfc4
·
verified ·
1 Parent(s): 9a85eb6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -17
Dockerfile CHANGED
@@ -1,28 +1,46 @@
1
  FROM devlikeapro/waha:latest
2
 
3
- # Install additional dependencies for Hugging Face Spaces
4
  USER root
5
 
6
- # Set up Chrome/Chromium dependencies and network tools
 
7
  RUN apt-get update && apt-get install -y \
 
8
  fonts-liberation \
9
  libasound2 \
10
  libatk-bridge2.0-0 \
11
  libatk1.0-0 \
12
- libatspi2.0-0 \
 
13
  libcups2 \
14
  libdbus-1-3 \
15
- libdrm2 \
 
16
  libgbm1 \
 
 
17
  libgtk-3-0 \
18
  libnspr4 \
19
  libnss3 \
20
- libwayland-client0 \
 
 
 
 
 
21
  libxcomposite1 \
 
22
  libxdamage1 \
 
23
  libxfixes3 \
24
- libxkbcommon0 \
25
  libxrandr2 \
 
 
 
 
 
26
  xdg-utils \
27
  dnsutils \
28
  iputils-ping \
@@ -32,28 +50,29 @@ RUN apt-get update && apt-get install -y \
32
  # Update CA certificates
33
  RUN update-ca-certificates
34
 
35
- # Hugging Face Spaces specific configurations
36
  ENV WAHA_LOG_LEVEL=debug
37
  ENV WHATSAPP_API_PORT=7860
38
  ENV WHATSAPP_API_HOSTNAME=0.0.0.0
39
 
40
- # Chrome/Puppeteer configurations for containerized environment
 
41
  ENV CHROME_BIN=/usr/bin/chromium
42
- ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
43
  ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
 
44
 
45
- # Disable Chrome sandbox and configure for container networking
46
- ENV CHROME_ARGS="--no-sandbox --disable-setuid-sandbox --disable-dev-shm-usage --disable-gpu --disable-software-rasterizer --disable-dev-tools --no-zygote"
47
 
48
- # DNS configuration
49
  ENV NODE_OPTIONS="--dns-result-order=ipv4first"
50
 
51
- # Create directory for sessions persistence
 
52
  RUN mkdir -p /app/.sessions && chown -R node:node /app/.sessions
53
 
 
54
  USER node
55
 
56
- # Expose port 7860 (required by Hugging Face Spaces)
57
- EXPOSE 7860
58
-
59
- # The base image already has the entrypoint configured
 
1
  FROM devlikeapro/waha:latest
2
 
3
+ # Switch to root to install system dependencies
4
  USER root
5
 
6
+ # 1. Install Chrome dependencies AND the Chromium browser itself
7
+ # We explicitly add 'chromium' here so the binary actually exists.
8
  RUN apt-get update && apt-get install -y \
9
+ chromium \
10
  fonts-liberation \
11
  libasound2 \
12
  libatk-bridge2.0-0 \
13
  libatk1.0-0 \
14
+ libc6 \
15
+ libcairo2 \
16
  libcups2 \
17
  libdbus-1-3 \
18
+ libexpat1 \
19
+ libfontconfig1 \
20
  libgbm1 \
21
+ libgcc1 \
22
+ libglib2.0-0 \
23
  libgtk-3-0 \
24
  libnspr4 \
25
  libnss3 \
26
+ libpango-1.0-0 \
27
+ libpangocairo-1.0-0 \
28
+ libstdc++6 \
29
+ libx11-6 \
30
+ libx11-xcb1 \
31
+ libxcb1 \
32
  libxcomposite1 \
33
+ libxcursor1 \
34
  libxdamage1 \
35
+ libxext6 \
36
  libxfixes3 \
37
+ libxi6 \
38
  libxrandr2 \
39
+ libxrender1 \
40
+ libxss1 \
41
+ libxtst6 \
42
+ lsb-release \
43
+ wget \
44
  xdg-utils \
45
  dnsutils \
46
  iputils-ping \
 
50
  # Update CA certificates
51
  RUN update-ca-certificates
52
 
53
+ # 2. Hugging Face Spaces Networking Setup
54
  ENV WAHA_LOG_LEVEL=debug
55
  ENV WHATSAPP_API_PORT=7860
56
  ENV WHATSAPP_API_HOSTNAME=0.0.0.0
57
 
58
+ # 3. Puppeteer & Chrome Configuration
59
+ # Point to the installed chromium binary
60
  ENV CHROME_BIN=/usr/bin/chromium
 
61
  ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
62
+ ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
63
 
64
+ # CRITICAL FIX: Added --dns-server=8.8.8.8 to bypass container DNS issues
65
+ ENV CHROME_ARGS="--no-sandbox --disable-setuid-sandbox --disable-dev-shm-usage --disable-gpu --disable-software-rasterizer --headless --dns-server=8.8.8.8"
66
 
67
+ # Fix potential Node.js DNS issues
68
  ENV NODE_OPTIONS="--dns-result-order=ipv4first"
69
 
70
+ # 4. Permissions & Storage
71
+ # Create a writable directory for sessions
72
  RUN mkdir -p /app/.sessions && chown -R node:node /app/.sessions
73
 
74
+ # Switch back to the non-root user
75
  USER node
76
 
77
+ # Expose the standard HF Spaces port
78
+ EXPOSE 7860