Spaces:
Paused
Paused
Upload 2 files
Browse files- Dockerfile +27 -0
- package.json +19 -0
Dockerfile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use the official Playwright image which includes all dependencies and browsers
|
| 2 |
+
FROM mcr.microsoft.com/playwright:v1.49.1-jammy
|
| 3 |
+
|
| 4 |
+
# Playwright image already has a user with UID 1000 (usually 'pwuser')
|
| 5 |
+
# We just need to ensure the app directory belongs to UID 1000
|
| 6 |
+
WORKDIR /app
|
| 7 |
+
RUN chown -R 1000:1000 /app
|
| 8 |
+
|
| 9 |
+
# Switch to the user with UID 1000
|
| 10 |
+
USER 1000
|
| 11 |
+
ENV HOME=/home/pwuser \
|
| 12 |
+
PATH=/home/pwuser/.local/bin:$PATH
|
| 13 |
+
|
| 14 |
+
# Playwright image already has browsers in a global location,
|
| 15 |
+
# so we don't need to install them again or set custom paths.
|
| 16 |
+
|
| 17 |
+
COPY --chown=1000:1000 package*.json ./
|
| 18 |
+
RUN npm install
|
| 19 |
+
|
| 20 |
+
# Copy application files
|
| 21 |
+
COPY --chown=1000:1000 . .
|
| 22 |
+
|
| 23 |
+
# Hugging Face requirement
|
| 24 |
+
ENV PORT=7860
|
| 25 |
+
EXPOSE 7860
|
| 26 |
+
|
| 27 |
+
CMD ["node", "server.js"]
|
package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "subtitle-scraper",
|
| 3 |
+
"version": "1.0.0",
|
| 4 |
+
"type": "module",
|
| 5 |
+
"author": "Hugoglu99",
|
| 6 |
+
"description": "Headless browser scraper for streaming subtitles",
|
| 7 |
+
"main": "server.js",
|
| 8 |
+
"scripts": {
|
| 9 |
+
"start": "node server.js"
|
| 10 |
+
},
|
| 11 |
+
"dependencies": {
|
| 12 |
+
"cors": "^2.8.5",
|
| 13 |
+
"dotenv": "^16.4.5",
|
| 14 |
+
"express": "^4.19.2",
|
| 15 |
+
"playwright": "1.49.1",
|
| 16 |
+
"playwright-extra": "^4.3.6",
|
| 17 |
+
"puppeteer-extra-plugin-stealth": "^2.11.2"
|
| 18 |
+
}
|
| 19 |
+
}
|