Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +27 -29
Dockerfile
CHANGED
|
@@ -1,12 +1,21 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
#
|
|
|
|
|
|
|
|
|
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
git \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
libasound2 \
|
| 7 |
libatk-bridge2.0-0 \
|
| 8 |
libatk1.0-0 \
|
| 9 |
libcups2 \
|
|
|
|
| 10 |
libgbm-dev \
|
| 11 |
libnspr4 \
|
| 12 |
libnss3 \
|
|
@@ -14,45 +23,34 @@ RUN apt-get update && apt-get install -y \
|
|
| 14 |
libxdamage1 \
|
| 15 |
libxfixes3 \
|
| 16 |
libxrandr2 \
|
|
|
|
|
|
|
|
|
|
| 17 |
xvfb \
|
| 18 |
--no-install-recommends && \
|
| 19 |
rm -rf /var/lib/apt/lists/*
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
# Clone your repository to temporary location
|
| 25 |
-
RUN git clone https://github.com/Kingdavid102/my-api.git .
|
| 26 |
-
|
| 27 |
-
# Move files to /app and clean up
|
| 28 |
-
RUN mkdir -p /app && \
|
| 29 |
-
mv ./* /app/ && \
|
| 30 |
-
mv ./.git* /app/ && \
|
| 31 |
-
cd /app && \
|
| 32 |
-
rm -rf /app-temp
|
| 33 |
|
| 34 |
-
# Set
|
| 35 |
-
RUN
|
| 36 |
|
|
|
|
| 37 |
WORKDIR /app
|
| 38 |
-
|
| 39 |
-
# Install dependencies
|
| 40 |
RUN npm install
|
| 41 |
|
| 42 |
-
#
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
# Set proper permissions for Playwright cache
|
| 46 |
-
RUN mkdir -p /home/node/.cache/ms-playwright && \
|
| 47 |
-
chown -R node:node /home/node/.cache
|
| 48 |
|
| 49 |
-
#
|
| 50 |
-
RUN
|
| 51 |
-
chown -R node:node /app/screenshots
|
| 52 |
|
| 53 |
-
#
|
| 54 |
-
|
| 55 |
|
|
|
|
| 56 |
EXPOSE 3000
|
| 57 |
|
|
|
|
| 58 |
CMD ["node", "server.js"]
|
|
|
|
| 1 |
+
# Use a lightweight Node.js image
|
| 2 |
+
FROM node:18-bullseye
|
| 3 |
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies required for Playwright
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
git \
|
| 10 |
+
wget \
|
| 11 |
+
curl \
|
| 12 |
+
unzip \
|
| 13 |
+
fonts-liberation \
|
| 14 |
libasound2 \
|
| 15 |
libatk-bridge2.0-0 \
|
| 16 |
libatk1.0-0 \
|
| 17 |
libcups2 \
|
| 18 |
+
libdbus-1-3 \
|
| 19 |
libgbm-dev \
|
| 20 |
libnspr4 \
|
| 21 |
libnss3 \
|
|
|
|
| 23 |
libxdamage1 \
|
| 24 |
libxfixes3 \
|
| 25 |
libxrandr2 \
|
| 26 |
+
xdg-utils \
|
| 27 |
+
libu2f-udev \
|
| 28 |
+
libvulkan1 \
|
| 29 |
xvfb \
|
| 30 |
--no-install-recommends && \
|
| 31 |
rm -rf /var/lib/apt/lists/*
|
| 32 |
|
| 33 |
+
# Clone the repository (Change the URL to your repo)
|
| 34 |
+
RUN git clone https://github.com/Kingdavid102/my-api.git /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
# Set correct permissions
|
| 37 |
+
RUN chmod -R 777 /app
|
| 38 |
|
| 39 |
+
# Install project dependencies
|
| 40 |
WORKDIR /app
|
|
|
|
|
|
|
| 41 |
RUN npm install
|
| 42 |
|
| 43 |
+
# Set Playwright cache path
|
| 44 |
+
ENV PLAYWRIGHT_BROWSERS_PATH=/home/node/.cache/ms-playwright
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
+
# Install Playwright browsers (force full installation)
|
| 47 |
+
RUN npx playwright install --with-deps chromium
|
|
|
|
| 48 |
|
| 49 |
+
# Fix permissions for Playwright
|
| 50 |
+
RUN chmod -R 777 /home/node/.cache/ms-playwright
|
| 51 |
|
| 52 |
+
# Expose a port
|
| 53 |
EXPOSE 3000
|
| 54 |
|
| 55 |
+
# Start the application
|
| 56 |
CMD ["node", "server.js"]
|