Update Dockerfile
Browse files- Dockerfile +13 -5
Dockerfile
CHANGED
|
@@ -4,7 +4,7 @@ FROM node:18-bullseye
|
|
| 4 |
# Set working directory inside the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Install
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
wget \
|
| 10 |
curl \
|
|
@@ -25,22 +25,30 @@ RUN apt-get update && apt-get install -y \
|
|
| 25 |
xdg-utils \
|
| 26 |
libu2f-udev \
|
| 27 |
libvulkan1 \
|
|
|
|
| 28 |
--no-install-recommends && \
|
| 29 |
rm -rf /var/lib/apt/lists/*
|
| 30 |
|
| 31 |
-
# Copy package.json and package-lock.json
|
| 32 |
COPY package.json ./
|
| 33 |
|
| 34 |
-
# Install dependencies
|
| 35 |
RUN npm install
|
| 36 |
|
| 37 |
-
# Install Playwright browsers
|
| 38 |
RUN npx playwright install --with-deps chromium
|
| 39 |
|
|
|
|
|
|
|
|
|
|
| 40 |
# Copy the application source code
|
| 41 |
COPY . .
|
| 42 |
|
| 43 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
EXPOSE 7860
|
| 45 |
|
| 46 |
# Start the application
|
|
|
|
| 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 \
|
|
|
|
| 25 |
xdg-utils \
|
| 26 |
libu2f-udev \
|
| 27 |
libvulkan1 \
|
| 28 |
+
xvfb \
|
| 29 |
--no-install-recommends && \
|
| 30 |
rm -rf /var/lib/apt/lists/*
|
| 31 |
|
| 32 |
+
# Copy package.json and package-lock.json first for caching
|
| 33 |
COPY package.json ./
|
| 34 |
|
| 35 |
+
# Install project dependencies
|
| 36 |
RUN npm install
|
| 37 |
|
| 38 |
+
# Install Playwright browsers and ensure Chromium is properly installed
|
| 39 |
RUN npx playwright install --with-deps chromium
|
| 40 |
|
| 41 |
+
# Set Playwright’s cache directory to ensure Chromium is available
|
| 42 |
+
ENV PLAYWRIGHT_BROWSERS_PATH=/home/node/.cache/ms-playwright
|
| 43 |
+
|
| 44 |
# Copy the application source code
|
| 45 |
COPY . .
|
| 46 |
|
| 47 |
+
# Ensure the container has the correct permissions
|
| 48 |
+
RUN chown -R node:node /home/node/.cache/ms-playwright && \
|
| 49 |
+
chmod -R 777 /home/node/.cache/ms-playwright
|
| 50 |
+
|
| 51 |
+
# Expose the port
|
| 52 |
EXPOSE 7860
|
| 53 |
|
| 54 |
# Start the application
|