Subham9126 commited on
Commit
f3baa28
·
verified ·
1 Parent(s): 2692bbd

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -17
Dockerfile CHANGED
@@ -1,24 +1,22 @@
1
- # Use the official Microsoft image which has Chromium pre-installed
2
  FROM mcr.microsoft.com/playwright:v1.50.0-jammy
3
 
4
- USER root
5
- WORKDIR /app
 
 
6
 
7
- # 1. Install Node.js, Nginx, and Supervisor
8
- RUN apt-get update && apt-get install -y curl nginx supervisor && \
9
- curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
10
- apt-get install -y nodejs && \
11
- apt-get clean
12
 
13
- # 2. Install the MCP Server globally
14
- RUN npm install -g @modelcontextprotocol/server-playwright
15
 
16
- # 3. Copy your local config files (Supervisord & Nginx)
17
- COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
18
- COPY nginx.conf /etc/nginx/sites-available/default
19
 
20
- # 4. Critical: Ensure Playwright is ready for headless mode
21
- RUN npx playwright install chromium
 
22
 
23
- EXPOSE 7860
24
- CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
 
 
1
  FROM mcr.microsoft.com/playwright:v1.50.0-jammy
2
 
3
+ # HF Spaces requires port 7860
4
+ ENV PORT=7860
5
+ ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
6
+ ENV DISPLAY=""
7
 
8
+ # Install Node.js deps
9
+ WORKDIR /app
10
+ COPY package.json package-lock.json ./
11
+ RUN npm ci
 
12
 
13
+ COPY . .
 
14
 
15
+ # Expose HF Spaces port
16
+ EXPOSE 7860
 
17
 
18
+ # Run as non-root (HF Spaces requirement)
19
+ RUN useradd -m appuser && chown -R appuser /app
20
+ USER appuser
21
 
22
+ CMD ["node", "server.js"]