Service-Xi commited on
Commit
67359f0
·
verified ·
1 Parent(s): d93dae7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -7
Dockerfile CHANGED
@@ -26,14 +26,18 @@ RUN apt-get update && apt-get install -y \
26
  --no-install-recommends && \
27
  rm -rf /var/lib/apt/lists/*
28
 
29
- # Create app directory
 
 
 
30
  WORKDIR /app
31
 
32
- # Clone repository (using the temp directory method to avoid conflicts)
33
  RUN git clone https://github.com/Kingdavid102/my-api.git /app-temp && \
34
  mv /app-temp/* /app/ && \
35
  mv /app-temp/.git* /app/ && \
36
- rm -rf /app-temp
 
37
 
38
  # Install dependencies
39
  RUN npm install
@@ -41,11 +45,13 @@ RUN npm install
41
  # Set Playwright cache path
42
  ENV PLAYWRIGHT_BROWSERS_PATH=/home/node/.cache/ms-playwright
43
 
44
- # Install Playwright browsers (force full installation)
45
- RUN npx playwright install --with-deps chromium
 
46
 
47
- # Fix permissions for Playwright
48
- RUN chmod -R 777 /home/node/.cache/ms-playwright
 
49
 
50
  # Run as non-root user
51
  USER node
 
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/Kingdavid102/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
 
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