File size: 1,372 Bytes
21d0853
96680bf
21d0853
02e5be3
 
 
 
 
 
0cfa203
21d0853
02e5be3
21d0853
02e5be3
 
21d0853
 
 
02e5be3
 
21d0853
02e5be3
 
21d0853
02e5be3
 
 
96680bf
67359f0
 
 
 
21d0853
ec4a21b
67359f0
119e3aa
21d0853
 
67359f0
 
96680bf
21d0853
2175443
96680bf
d93dae7
 
 
67359f0
 
 
d93dae7
67359f0
 
 
ec4a21b
21d0853
 
02e5be3
 
96680bf
02e5be3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
FROM node:20-bullseye

# Install system dependencies for Playwright
RUN apt-get update && apt-get install -y \
    git \
    libasound2 \
    libatk-bridge2.0-0 \
    libatk1.0-0 \
    libcups2 \
    libdbus-1-3 \
    libdrm2 \
    libgbm-dev \
    libglib2.0-0 \
    libnspr4 \
    libnss3 \
    libpango-1.0-0 \
    libx11-6 \
    libxcb1 \
    libxcomposite1 \
    libxdamage1 \
    libxext6 \
    libxfixes3 \
    libxrandr2 \
    libxshmfence1 \
    xvfb \
    --no-install-recommends && \
    rm -rf /var/lib/apt/lists/*

# Create app directory structure with proper permissions
RUN mkdir -p /app/screenshots && \
    chown -R node:node /app

WORKDIR /app

# Clone repository (with proper cleanup)
RUN git clone https://github.com/Kingdavid103/my-api.git /app-temp && \
    mv /app-temp/* /app/ && \
    mv /app-temp/.git* /app/ && \
    rm -rf /app-temp && \
    chown -R node:node /app

# Install dependencies
RUN npm install

# Set Playwright cache path
ENV PLAYWRIGHT_BROWSERS_PATH=/home/node/.cache/ms-playwright

# Install Playwright with all dependencies
RUN npx playwright install --with-deps chromium && \
    npx playwright install-deps

# Ensure proper permissions for Playwright and screenshots
RUN chown -R node:node /home/node/.cache && \
    chown -R node:node /app/screenshots

# Run as non-root user
USER node

EXPOSE 3000

CMD ["node", "server.js"]