Update Dockerfile
Browse files- Dockerfile +37 -26
Dockerfile
CHANGED
@@ -1,43 +1,54 @@
|
|
1 |
-
#
|
2 |
-
FROM node:
|
3 |
|
4 |
-
#
|
|
|
|
|
|
|
5 |
RUN apt-get update && apt-get install -y \
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
7 |
libatk1.0-0 \
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
10 |
libxcomposite1 \
|
11 |
-
libxcursor1 \
|
12 |
libxdamage1 \
|
13 |
libxfixes3 \
|
14 |
-
libxi6 \
|
15 |
libxrandr2 \
|
16 |
-
libxrender1 \
|
17 |
-
libxss1 \
|
18 |
-
libxtst6 \
|
19 |
-
ca-certificates \
|
20 |
-
fonts-liberation \
|
21 |
-
libasound2 \
|
22 |
-
libgbm1 \
|
23 |
-
libgtk-3-0 \
|
24 |
xdg-utils \
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
-
# Set
|
28 |
-
|
29 |
|
30 |
-
# Copy package.json and
|
31 |
COPY package.json ./
|
32 |
-
RUN npm install cheerio puppeteer-extra puppeteer-extra-plugin-stealth puppeteer
|
33 |
|
34 |
-
#
|
35 |
-
RUN
|
36 |
|
37 |
-
#
|
|
|
|
|
|
|
38 |
COPY . .
|
39 |
|
|
|
|
|
|
|
40 |
EXPOSE 7860
|
41 |
|
42 |
-
# Start
|
43 |
-
CMD ["node", "
|
|
|
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 |
+
RUN mkdir -p /app/downloads && chmod -R 777 /app/downloads
|
49 |
+
|
50 |
+
# Expose the port
|
51 |
EXPOSE 7860
|
52 |
|
53 |
+
# Start the application (REMOVE playwright install from CMD)
|
54 |
+
CMD ["node", "server.js"]
|