Spaces:
Sleeping
Sleeping
T1ckbase commited on
Commit ·
af972a5
1
Parent(s): 5dab452
- Dockerfile +10 -1
- main.ts +7 -1
- package.json +1 -0
- pnpm-lock.yaml +15 -0
- start.sh +6 -0
Dockerfile
CHANGED
|
@@ -1,5 +1,11 @@
|
|
| 1 |
FROM node:latest
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
ENV PNPM_HOME="/pnpm"
|
| 4 |
|
| 5 |
ENV PATH="$PNPM_HOME:$PATH"
|
|
@@ -18,6 +24,9 @@ COPY . .
|
|
| 18 |
|
| 19 |
RUN pnpm exec playwright install --with-deps chrome
|
| 20 |
|
|
|
|
|
|
|
|
|
|
| 21 |
EXPOSE 9222
|
| 22 |
|
| 23 |
-
CMD ["
|
|
|
|
| 1 |
FROM node:latest
|
| 2 |
|
| 3 |
+
RUN apt-get update && apt-get install -y wget && \
|
| 4 |
+
wget -q https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && \
|
| 5 |
+
dpkg -i cloudflared-linux-amd64.deb && \
|
| 6 |
+
rm cloudflared-linux-amd64.deb && \
|
| 7 |
+
apt-get clean
|
| 8 |
+
|
| 9 |
ENV PNPM_HOME="/pnpm"
|
| 10 |
|
| 11 |
ENV PATH="$PNPM_HOME:$PATH"
|
|
|
|
| 24 |
|
| 25 |
RUN pnpm exec playwright install --with-deps chrome
|
| 26 |
|
| 27 |
+
COPY start.sh /app/start.sh
|
| 28 |
+
RUN chmod +x /app/start.sh
|
| 29 |
+
|
| 30 |
EXPOSE 9222
|
| 31 |
|
| 32 |
+
CMD ["/app/start.sh"]
|
main.ts
CHANGED
|
@@ -1,19 +1,25 @@
|
|
| 1 |
import { chromium, devices } from 'playwright';
|
|
|
|
| 2 |
// import { serve } from '@hono/node-server';
|
| 3 |
// import { Hono } from 'hono';
|
| 4 |
|
| 5 |
// https://t1ckbase-remote-playwright-test.hf.space
|
| 6 |
|
| 7 |
// const app = new Hono();
|
|
|
|
| 8 |
// app.get('/hello', (c) => c.text('Hello Node.js!'));
|
|
|
|
|
|
|
|
|
|
| 9 |
// serve({
|
| 10 |
// port: 9222,
|
| 11 |
// fetch: app.fetch,
|
|
|
|
| 12 |
// });
|
| 13 |
|
| 14 |
const browser = await chromium.launch({
|
| 15 |
headless: true,
|
| 16 |
-
args: ['--disable-blink-features=AutomationControlled', '--remote-debugging-address=0.0.0.0', '--remote-debugging-port=9222'],
|
| 17 |
channel: 'chrome',
|
| 18 |
});
|
| 19 |
const context = await browser.newContext({
|
|
|
|
| 1 |
import { chromium, devices } from 'playwright';
|
| 2 |
+
// import { createSecureServer } from 'node:http2';
|
| 3 |
// import { serve } from '@hono/node-server';
|
| 4 |
// import { Hono } from 'hono';
|
| 5 |
|
| 6 |
// https://t1ckbase-remote-playwright-test.hf.space
|
| 7 |
|
| 8 |
// const app = new Hono();
|
| 9 |
+
|
| 10 |
// app.get('/hello', (c) => c.text('Hello Node.js!'));
|
| 11 |
+
|
| 12 |
+
// app.get('/json', async (c) => await fetch('http://127.0.0.1:9222/json'));
|
| 13 |
+
|
| 14 |
// serve({
|
| 15 |
// port: 9222,
|
| 16 |
// fetch: app.fetch,
|
| 17 |
+
// createServer: createSecureServer,
|
| 18 |
// });
|
| 19 |
|
| 20 |
const browser = await chromium.launch({
|
| 21 |
headless: true,
|
| 22 |
+
args: ['--disable-blink-features=AutomationControlled', '--remote-debugging-address=0.0.0.0', '--remote-debugging-port=9222', '--no-sandbox', '--headless=new'],
|
| 23 |
channel: 'chrome',
|
| 24 |
});
|
| 25 |
const context = await browser.newContext({
|
package.json
CHANGED
|
@@ -9,6 +9,7 @@
|
|
| 9 |
"playwright": "^1.52.0"
|
| 10 |
},
|
| 11 |
"devDependencies": {
|
|
|
|
| 12 |
"prettier": "^3.5.3"
|
| 13 |
},
|
| 14 |
"type": "module",
|
|
|
|
| 9 |
"playwright": "^1.52.0"
|
| 10 |
},
|
| 11 |
"devDependencies": {
|
| 12 |
+
"@types/node": "^22.15.18",
|
| 13 |
"prettier": "^3.5.3"
|
| 14 |
},
|
| 15 |
"type": "module",
|
pnpm-lock.yaml
CHANGED
|
@@ -21,6 +21,9 @@ importers:
|
|
| 21 |
specifier: ^1.52.0
|
| 22 |
version: 1.52.0
|
| 23 |
devDependencies:
|
|
|
|
|
|
|
|
|
|
| 24 |
prettier:
|
| 25 |
specifier: ^3.5.3
|
| 26 |
version: 3.5.3
|
|
@@ -33,6 +36,9 @@ packages:
|
|
| 33 |
peerDependencies:
|
| 34 |
hono: ^4
|
| 35 |
|
|
|
|
|
|
|
|
|
|
| 36 |
fsevents@2.3.2:
|
| 37 |
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
|
| 38 |
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
|
@@ -57,12 +63,19 @@ packages:
|
|
| 57 |
engines: {node: '>=14'}
|
| 58 |
hasBin: true
|
| 59 |
|
|
|
|
|
|
|
|
|
|
| 60 |
snapshots:
|
| 61 |
|
| 62 |
'@hono/node-server@1.14.1(hono@4.7.9)':
|
| 63 |
dependencies:
|
| 64 |
hono: 4.7.9
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
fsevents@2.3.2:
|
| 67 |
optional: true
|
| 68 |
|
|
@@ -77,3 +90,5 @@ snapshots:
|
|
| 77 |
fsevents: 2.3.2
|
| 78 |
|
| 79 |
prettier@3.5.3: {}
|
|
|
|
|
|
|
|
|
| 21 |
specifier: ^1.52.0
|
| 22 |
version: 1.52.0
|
| 23 |
devDependencies:
|
| 24 |
+
'@types/node':
|
| 25 |
+
specifier: ^22.15.18
|
| 26 |
+
version: 22.15.18
|
| 27 |
prettier:
|
| 28 |
specifier: ^3.5.3
|
| 29 |
version: 3.5.3
|
|
|
|
| 36 |
peerDependencies:
|
| 37 |
hono: ^4
|
| 38 |
|
| 39 |
+
'@types/node@22.15.18':
|
| 40 |
+
resolution: {integrity: sha512-v1DKRfUdyW+jJhZNEI1PYy29S2YRxMV5AOO/x/SjKmW0acCIOqmbj6Haf9eHAhsPmrhlHSxEhv/1WszcLWV4cg==}
|
| 41 |
+
|
| 42 |
fsevents@2.3.2:
|
| 43 |
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
|
| 44 |
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
|
|
|
| 63 |
engines: {node: '>=14'}
|
| 64 |
hasBin: true
|
| 65 |
|
| 66 |
+
undici-types@6.21.0:
|
| 67 |
+
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
|
| 68 |
+
|
| 69 |
snapshots:
|
| 70 |
|
| 71 |
'@hono/node-server@1.14.1(hono@4.7.9)':
|
| 72 |
dependencies:
|
| 73 |
hono: 4.7.9
|
| 74 |
|
| 75 |
+
'@types/node@22.15.18':
|
| 76 |
+
dependencies:
|
| 77 |
+
undici-types: 6.21.0
|
| 78 |
+
|
| 79 |
fsevents@2.3.2:
|
| 80 |
optional: true
|
| 81 |
|
|
|
|
| 90 |
fsevents: 2.3.2
|
| 91 |
|
| 92 |
prettier@3.5.3: {}
|
| 93 |
+
|
| 94 |
+
undici-types@6.21.0: {}
|
start.sh
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# start.sh
|
| 3 |
+
|
| 4 |
+
pnpm run start &
|
| 5 |
+
|
| 6 |
+
cloudflared tunnel --url "http://localhost:9222"
|