srivatsavdamaraju commited on
Commit
2ea979a
·
verified ·
1 Parent(s): b6df57c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -19
Dockerfile CHANGED
@@ -1,15 +1,12 @@
1
  # Use official Node.js 18 slim image
2
  FROM node:18-slim
3
 
4
- # Set environment variables for Puppeteer
5
- ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
6
- PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
7
-
8
- # Install only essential dependencies in a single layer
9
  RUN apt-get update && apt-get install -y \
10
  chromium \
 
 
11
  fonts-liberation \
12
- libappindicator3-1 \
13
  libasound2 \
14
  libatk-bridge2.0-0 \
15
  libatk1.0-0 \
@@ -28,30 +25,25 @@ RUN apt-get update && apt-get install -y \
28
  libxtst6 \
29
  xdg-utils \
30
  --no-install-recommends \
31
- && apt-get clean \
32
- && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 
 
 
33
 
34
- # Set working directory
35
  WORKDIR /app
36
 
37
- # Copy package files first (better layer caching)
38
  COPY package*.json ./
 
39
 
40
- # Install dependencies - use npm install instead of npm ci if no lock file
41
- RUN npm install --production && npm cache clean --force
42
-
43
- # Copy only necessary source code files
44
  COPY . .
45
 
46
- # Create non-root user for security
47
  RUN groupadd -r nodeuser && useradd -r -g nodeuser nodeuser \
48
  && chown -R nodeuser:nodeuser /app
49
 
50
- # Switch to non-root user
51
  USER nodeuser
52
 
53
- # Expose port
54
  EXPOSE 7860
55
 
56
- # Start the server
57
- CMD ["node", "server.js"]
 
1
  # Use official Node.js 18 slim image
2
  FROM node:18-slim
3
 
4
+ # Install Chromium + all required dependencies
 
 
 
 
5
  RUN apt-get update && apt-get install -y \
6
  chromium \
7
+ chromium-common \
8
+ chromium-sandbox \
9
  fonts-liberation \
 
10
  libasound2 \
11
  libatk-bridge2.0-0 \
12
  libatk1.0-0 \
 
25
  libxtst6 \
26
  xdg-utils \
27
  --no-install-recommends \
28
+ && rm -rf /var/lib/apt/lists/*
29
+
30
+ # Tell Puppeteer to use system Chromium
31
+ ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
32
+ ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
33
 
 
34
  WORKDIR /app
35
 
 
36
  COPY package*.json ./
37
+ RUN npm install --production
38
 
 
 
 
 
39
  COPY . .
40
 
41
+ # Create non-root user
42
  RUN groupadd -r nodeuser && useradd -r -g nodeuser nodeuser \
43
  && chown -R nodeuser:nodeuser /app
44
 
 
45
  USER nodeuser
46
 
 
47
  EXPOSE 7860
48
 
49
+ CMD ["node", "server.js"]