Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +17 -9
Dockerfile
CHANGED
|
@@ -1,20 +1,28 @@
|
|
| 1 |
-
# Use the official Playwright image
|
| 2 |
FROM mcr.microsoft.com/playwright:v1.45.0-jammy
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
USER user
|
| 7 |
ENV HOME=/home/user \
|
| 8 |
PATH=/home/user/.local/bin:$PATH
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
# Pre-install browsers (Chromium) to save time on startup
|
| 13 |
RUN npx playwright install chromium
|
| 14 |
|
| 15 |
-
#
|
| 16 |
EXPOSE 7860
|
| 17 |
|
| 18 |
-
#
|
| 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"]
|