playwright / Dockerfile
abcd118q's picture
Update Dockerfile
a839a45 verified
raw
history blame contribute delete
756 Bytes
# Use the official Playwright image
FROM mcr.microsoft.com/playwright:v1.45.0-jammy
# Switch to root to fix the user conflict
USER root
# Rename the existing 'pwuser' (UID 1000) to 'user' and update its home directory
RUN usermod -l user pwuser && \
usermod -d /home/user -m user && \
groupmod -n user pwuser
# Set permissions for the app directory
WORKDIR /home/user/app
RUN chown -R user:user /home/user/app
# Switch to the renamed user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Install Chromium (Playwright needs this)
RUN npx playwright install chromium
# Hugging Face default port
EXPOSE 7860
# Start the server
CMD ["npx", "playwright", "run-server", "--port", "7860", "--host", "0.0.0.0", "--path", "/ws"]