Stylique commited on
Commit
3b14c15
·
verified ·
1 Parent(s): 7f69117

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +41 -25
Dockerfile CHANGED
@@ -1,43 +1,59 @@
1
- FROM ubuntu:22.04
2
 
3
- ENV DEBIAN_FRONTEND=noninteractive
4
-
5
- # Install NVIDIA drivers and CUDA libraries for L4
6
  RUN apt-get update && apt-get install -y \
7
- curl ca-certificates wget \
8
- # NVIDIA/CUDA for L4
9
- nvidia-driver-525-server \
10
- nvidia-utils-525-server \
11
- libnvidia-encode-525-server \
12
- libnvidia-decode-525-server \
13
- # FFmpeg with CUDA support
14
- ffmpeg \
15
  # Chrome dependencies
16
- libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 \
17
- libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 \
18
- libxrandr2 libgbm1 libasound2 libpangocairo-1.0-0 \
19
- # GPU tools
20
- pciutils mesa-utils vulkan-tools \
21
- && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
22
- && apt-get install -y nodejs \
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  && wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
24
  && apt-get install -y ./google-chrome-stable_current_amd64.deb \
25
  && rm google-chrome-stable_current_amd64.deb \
26
  && apt-get clean \
27
  && rm -rf /var/lib/apt/lists/*
28
 
29
- # Set NVIDIA environment variables
30
- ENV NVIDIA_VISIBLE_DEVICES=all
31
- ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,graphics,video
32
-
33
  WORKDIR /app
 
 
34
  COPY package*.json ./
35
- RUN npm install
 
 
 
 
36
  COPY . .
37
 
 
 
 
38
  ENV CHROME_BIN=/usr/bin/google-chrome-stable
 
39
  ENV NODE_OPTIONS="--max-old-space-size=24576"
40
- ENV PORT=7860
41
 
 
 
 
 
 
42
  EXPOSE 7860
 
 
43
  CMD ["node", "server.js"]
 
1
+ FROM node:20-slim
2
 
3
+ # Install system dependencies
 
 
4
  RUN apt-get update && apt-get install -y \
 
 
 
 
 
 
 
 
5
  # Chrome dependencies
6
+ wget \
7
+ gnupg \
8
+ libnss3 \
9
+ libatk1.0-0 \
10
+ libatk-bridge2.0-0 \
11
+ libcups2 \
12
+ libdrm2 \
13
+ libxkbcommon0 \
14
+ libxcomposite1 \
15
+ libxdamage1 \
16
+ libxfixes3 \
17
+ libxrandr2 \
18
+ libgbm1 \
19
+ libasound2 \
20
+ libpangocairo-1.0-0 \
21
+ # FFmpeg
22
+ ffmpeg \
23
+ # System tools
24
+ ca-certificates \
25
+ curl \
26
  && wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
27
  && apt-get install -y ./google-chrome-stable_current_amd64.deb \
28
  && rm google-chrome-stable_current_amd64.deb \
29
  && apt-get clean \
30
  && rm -rf /var/lib/apt/lists/*
31
 
32
+ # Create app directory
 
 
 
33
  WORKDIR /app
34
+
35
+ # Copy package files
36
  COPY package*.json ./
37
+
38
+ # Install dependencies (production only)
39
+ RUN npm ci --only=production && npm cache clean --force
40
+
41
+ # Copy application
42
  COPY . .
43
 
44
+ # Environment variables
45
+ ENV NODE_ENV=production
46
+ ENV PORT=7860
47
  ENV CHROME_BIN=/usr/bin/google-chrome-stable
48
+ ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
49
  ENV NODE_OPTIONS="--max-old-space-size=24576"
 
50
 
51
+ # Health check
52
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
53
+ CMD curl -f http://localhost:7860/health || exit 1
54
+
55
+ # Expose port
56
  EXPOSE 7860
57
+
58
+ # Start application
59
  CMD ["node", "server.js"]