deepak191z commited on
Commit
afdd5d6
·
verified ·
1 Parent(s): 829f956

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -8
Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
  FROM node:20
2
 
3
- # Create a non-root user
4
- RUN groupadd -r appuser && useradd -r -g appuser appuser
5
 
6
  # Set working directory
7
  WORKDIR /usr/src/app
@@ -10,17 +10,19 @@ WORKDIR /usr/src/app
10
  COPY package*.json ./
11
  RUN npm install
12
 
13
- # Install Playwright and ensure proper ownership
 
 
 
 
 
 
14
  RUN npx playwright install --with-deps && \
15
- mkdir -p /home/appuser/.cache/ms-playwright && \
16
- chown -R appuser:appuser /home/appuser/.cache/ms-playwright /usr/src/app
17
 
18
  # Copy application source code
19
  COPY . .
20
 
21
- # Switch to non-root user
22
- USER appuser
23
-
24
  # Expose the desired port
25
  EXPOSE 7860
26
 
 
1
  FROM node:20
2
 
3
+ # Create a non-root user with a home directory
4
+ RUN groupadd -r appuser && useradd -m -r -g appuser appuser
5
 
6
  # Set working directory
7
  WORKDIR /usr/src/app
 
10
  COPY package*.json ./
11
  RUN npm install
12
 
13
+ # Switch to non-root user to install Playwright browsers in the correct home
14
+ USER appuser
15
+
16
+ # Set environment variable for Playwright browser path
17
+ ENV PLAYWRIGHT_BROWSERS_PATH=/home/appuser/.cache/ms-playwright
18
+
19
+ # Install Playwright browsers and ensure the cache directory exists
20
  RUN npx playwright install --with-deps && \
21
+ mkdir -p /home/appuser/.cache/ms-playwright
 
22
 
23
  # Copy application source code
24
  COPY . .
25
 
 
 
 
26
  # Expose the desired port
27
  EXPOSE 7860
28