Reaperxxxx commited on
Commit
33a5f2d
·
verified ·
1 Parent(s): 4525542

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +33 -16
Dockerfile CHANGED
@@ -1,35 +1,52 @@
1
- # Use an official Node.js runtime as the base image
2
- FROM node:18
3
 
4
- # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
- # Install Express and Puppeteer globally
8
- RUN npm install express puppeteer
9
-
10
- # Install additional Puppeteer dependencies (for headless Chromium)
11
  RUN apt-get update && apt-get install -y \
12
  wget \
13
- ca-certificates \
 
14
  fonts-liberation \
15
- libappindicator3-1 \
16
  libasound2 \
 
17
  libatk1.0-0 \
18
  libcups2 \
19
  libdbus-1-3 \
 
 
 
20
  libxcomposite1 \
21
  libxdamage1 \
 
22
  libxrandr2 \
23
- libxss1 \
24
- libxtst6 \
25
- --no-install-recommends \
26
- && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
- # Copy the project files
29
  COPY . .
30
 
31
- # Expose the API port
32
  EXPOSE 7860
33
 
34
- # Start the server
35
  CMD ["node", "server.js"]
 
1
+ # Use an official Node.js runtime as a base image
2
+ FROM node:18-bullseye
3
 
4
+ # Set working directory inside the container
5
  WORKDIR /app
6
 
7
+ # Install system dependencies required for Playwright
 
 
 
8
  RUN apt-get update && apt-get install -y \
9
  wget \
10
+ curl \
11
+ unzip \
12
  fonts-liberation \
 
13
  libasound2 \
14
+ libatk-bridge2.0-0 \
15
  libatk1.0-0 \
16
  libcups2 \
17
  libdbus-1-3 \
18
+ libgbm-dev \
19
+ libnspr4 \
20
+ libnss3 \
21
  libxcomposite1 \
22
  libxdamage1 \
23
+ libxfixes3 \
24
  libxrandr2 \
25
+ xdg-utils \
26
+ libu2f-udev \
27
+ libvulkan1 \
28
+ xvfb \
29
+ chromium \
30
+ --no-install-recommends && \
31
+ rm -rf /var/lib/apt/lists/*
32
+
33
+ # Set environment variable for Playwright browsers path
34
+ ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
35
+
36
+ # Copy package.json and package-lock.json first for caching
37
+ COPY package.json ./
38
+
39
+ # Install project dependencies
40
+ RUN npm install
41
+
42
+ # Install Playwright browsers
43
+ RUN npx playwright install --with-deps chromium
44
 
45
+ # Copy the application source code
46
  COPY . .
47
 
48
+ # Expose the port
49
  EXPOSE 7860
50
 
51
+ # Start the application (REMOVE playwright install from CMD)
52
  CMD ["node", "server.js"]