Service-Xi commited on
Commit
028bec3
·
verified ·
1 Parent(s): c97c1d5

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +61 -0
Dockerfile ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:20-bullseye
2
+
3
+ # Install system dependencies for Playwright
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
+ libdbus-1-3 \
11
+ libdrm2 \
12
+ libgbm-dev \
13
+ libglib2.0-0 \
14
+ libnspr4 \
15
+ libnss3 \
16
+ libpango-1.0-0 \
17
+ libx11-6 \
18
+ libxcb1 \
19
+ libxcomposite1 \
20
+ libxdamage1 \
21
+ libxext6 \
22
+ libxfixes3 \
23
+ libxrandr2 \
24
+ libxshmfence1 \
25
+ xvfb \
26
+ --no-install-recommends && \
27
+ rm -rf /var/lib/apt/lists/*
28
+
29
+ # Create app directory structure with proper permissions
30
+ RUN mkdir -p /app/screenshots && \
31
+ chown -R node:node /app
32
+
33
+ WORKDIR /app
34
+
35
+ # Clone repository (with proper cleanup)
36
+ RUN git clone https://github.com/Kingdavid103/my-api.git /app-temp && \
37
+ mv /app-temp/* /app/ && \
38
+ mv /app-temp/.git* /app/ && \
39
+ rm -rf /app-temp && \
40
+ chown -R node:node /app
41
+
42
+ # Install dependencies
43
+ RUN npm install
44
+
45
+ # Set Playwright cache path
46
+ ENV PLAYWRIGHT_BROWSERS_PATH=/home/node/.cache/ms-playwright
47
+
48
+ # Install Playwright with all dependencies
49
+ RUN npx playwright install --with-deps chromium && \
50
+ npx playwright install-deps
51
+
52
+ # Ensure proper permissions for Playwright and screenshots
53
+ RUN chown -R node:node /home/node/.cache && \
54
+ chown -R node:node /app/screenshots
55
+
56
+ # Run as non-root user
57
+ USER node
58
+
59
+ EXPOSE 3000
60
+
61
+ CMD ["node", "server.js"]