Service-Xi commited on
Commit
02e5be3
·
verified ·
1 Parent(s): 2175443

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +40 -11
Dockerfile CHANGED
@@ -1,20 +1,49 @@
1
- # Use Node 20 LTS
2
- FROM node:20-alpine
3
 
4
- # Install git
5
- RUN apk add --no-cache git
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
- # Clone your repo directly into /app
8
- RUN git clone https://github.com/Kingdavid102/my-api.git /app
 
9
 
10
- # Set working directory
11
  WORKDIR /app
12
 
 
 
 
 
13
  # Install dependencies
14
  RUN npm install
15
 
16
- # Expose app port
17
- EXPOSE 7860
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
- # Start app
20
- CMD ["npm", "start"]
 
1
+ FROM node:20-bullseye
 
2
 
3
+ # Install system dependencies
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 \
13
+ libxcomposite1 \
14
+ libxdamage1 \
15
+ libxfixes3 \
16
+ libxrandr2 \
17
+ xvfb \
18
+ --no-install-recommends && \
19
+ rm -rf /var/lib/apt/lists/*
20
 
21
+ # Create app directory and set permissions
22
+ RUN mkdir -p /app/screenshots && \
23
+ chown -R node:node /app
24
 
 
25
  WORKDIR /app
26
 
27
+ # Clone your repository
28
+ RUN git clone https://github.com/TechHenzy/henz-api-1.git /app && \
29
+ chown -R node:node /app
30
+
31
  # Install dependencies
32
  RUN npm install
33
 
34
+ # Install Playwright browsers
35
+ RUN npx playwright install --with-deps chromium
36
+
37
+ # Set proper permissions for Playwright cache
38
+ RUN mkdir -p /home/node/.cache/ms-playwright && \
39
+ chown -R node:node /home/node/.cache
40
+
41
+ # Run as non-root user
42
+ USER node
43
+
44
+ # Create screenshots directory with proper permissions at runtime
45
+ RUN mkdir -p /app/screenshots
46
+
47
+ EXPOSE 3000
48
 
49
+ CMD ["node", "server.js"]