abcd118q commited on
Commit
a839a45
·
verified ·
1 Parent(s): 5f6a15a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -9
Dockerfile CHANGED
@@ -1,20 +1,28 @@
1
- # Use the official Playwright image with Jammy (Ubuntu 22.04)
2
  FROM mcr.microsoft.com/playwright:v1.45.0-jammy
3
 
4
- # Hugging Face runs on user ID 1000
5
- RUN useradd -m -u 1000 user
 
 
 
 
 
 
 
 
 
 
 
6
  USER user
7
  ENV HOME=/home/user \
8
  PATH=/home/user/.local/bin:$PATH
9
 
10
- WORKDIR $HOME/app
11
-
12
- # Pre-install browsers (Chromium) to save time on startup
13
  RUN npx playwright install chromium
14
 
15
- # Expose port 7860 (The default port for Hugging Face Spaces)
16
  EXPOSE 7860
17
 
18
- # Launch the Playwright server
19
- # --path /ws makes your connection URL predictable
20
  CMD ["npx", "playwright", "run-server", "--port", "7860", "--host", "0.0.0.0", "--path", "/ws"]
 
1
+ # Use the official Playwright image
2
  FROM mcr.microsoft.com/playwright:v1.45.0-jammy
3
 
4
+ # Switch to root to fix the user conflict
5
+ USER root
6
+
7
+ # Rename the existing 'pwuser' (UID 1000) to 'user' and update its home directory
8
+ RUN usermod -l user pwuser && \
9
+ usermod -d /home/user -m user && \
10
+ groupmod -n user pwuser
11
+
12
+ # Set permissions for the app directory
13
+ WORKDIR /home/user/app
14
+ RUN chown -R user:user /home/user/app
15
+
16
+ # Switch to the renamed user
17
  USER user
18
  ENV HOME=/home/user \
19
  PATH=/home/user/.local/bin:$PATH
20
 
21
+ # Install Chromium (Playwright needs this)
 
 
22
  RUN npx playwright install chromium
23
 
24
+ # Hugging Face default port
25
  EXPOSE 7860
26
 
27
+ # Start the server
 
28
  CMD ["npx", "playwright", "run-server", "--port", "7860", "--host", "0.0.0.0", "--path", "/ws"]