likhonsheikh commited on
Commit
2286d88
·
verified ·
1 Parent(s): da2fbc1

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -17
Dockerfile CHANGED
@@ -1,22 +1,24 @@
1
- # Smaller base: only Chrome, Grid + noVNC
2
- FROM selenium/standalone-chrome:latest
3
 
4
- # Set timezone
5
- ENV TZ=UTC
6
 
7
- # Hugging Face expects your app to listen on this port
8
- ENV APP_PORT=7900
 
 
9
 
10
- # Selenium config
11
- ENV SE_NODE_MAX_SESSIONS=1
12
- ENV SE_NODE_SESSION_TIMEOUT=300
13
- ENV SE_VNC_NO_PASSWORD=1
14
- ENV SE_SCREEN_WIDTH=1280
15
- ENV SE_SCREEN_HEIGHT=720
16
- ENV SE_SCREEN_DEPTH=24
17
 
18
- # Hugging Face only exposes one port, so we run noVNC there
19
- EXPOSE ${APP_PORT}
 
 
 
 
 
 
 
 
 
20
 
21
- # Start Selenium and noVNC on the same port
22
- CMD ["bash", "-c", "SE_VNC_PORT=${APP_PORT} /opt/bin/entry_point.sh"]
 
1
+ # Dockerfile for lightweight Playwright + FastAPI app on Hugging Face Space
 
2
 
3
+ FROM python:3.11-slim
 
4
 
5
+ # Install dependencies
6
+ RUN apt-get update && apt-get install -y \
7
+ libnss3 libatk-bridge2.0-0 libgtk-3-0 libx11-xcb1 libxcomposite1 libxdamage1 libxrandr2 libgbm1 libasound2 curl \
8
+ && rm -rf /var/lib/apt/lists/*
9
 
10
+ # Install Playwright and FastAPI dependencies
11
+ RUN pip install --no-cache-dir fastapi uvicorn "playwright>=1.37.0" httpx
 
 
 
 
 
12
 
13
+ # Install Playwright browsers
14
+ RUN playwright install
15
+
16
+ WORKDIR /app
17
+
18
+ COPY ./app /app
19
+
20
+ ENV PORT=7860
21
+ EXPOSE 7860
22
+
23
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
24