WaveCut commited on
Commit
6c6e088
·
verified ·
1 Parent(s): 20134b6

Serve prebuilt app on Docker CPU Basic

Browse files

Switch from credit-gated Static Space to a minimal Nginx Docker Space on port 7860. The container copies the verified dist bundle and preserves cross-origin isolation headers.

Files changed (4) hide show
  1. .dockerignore +5 -0
  2. Dockerfile +14 -0
  3. README.md +14 -17
  4. nginx.conf +41 -0
.dockerignore ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ *
2
+ !Dockerfile
3
+ !nginx.conf
4
+ !dist/
5
+ !dist/**
Dockerfile ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nginx:1.29-alpine@sha256:5616878291a2eed594aee8db4dade5878cf7edcb475e59193904b198d9b830de
2
+
3
+ RUN adduser -D -u 1000 user
4
+
5
+ COPY nginx.conf /etc/nginx/nginx.conf
6
+ COPY --chown=user:user dist/ /home/user/app/
7
+
8
+ USER user
9
+ EXPOSE 7860
10
+
11
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
12
+ CMD wget -qO- http://127.0.0.1:7860/healthz || exit 1
13
+
14
+ CMD ["nginx", "-g", "daemon off;"]
README.md CHANGED
@@ -3,16 +3,13 @@ title: Bonsai WebGPU Chat
3
  emoji: 🌱
4
  colorFrom: green
5
  colorTo: gray
6
- sdk: static
7
- app_file: dist/index.html
 
8
  fullWidth: true
9
  short_description: Browser-local Bonsai WebGPU chat with agentic tools
10
  models:
11
  - WaveCut/Bonsai-web-GGUF
12
- custom_headers:
13
- cross-origin-embedder-policy: require-corp
14
- cross-origin-opener-policy: same-origin
15
- cross-origin-resource-policy: cross-origin
16
  ---
17
 
18
  # Bonsai WebGPU Chat
@@ -37,16 +34,17 @@ to release commit `d85382fa09fe868c0242d81488dfc2edd8d3729b` (tag
37
  weight commit `112ea7a1a6229bde132b176b9a72477a7ecfde64`. Every shard has a recorded
38
  byte size and SHA-256.
39
 
40
- The repository includes the verified `dist/` production bundle because the
41
- current Hugging Face free static runtime requires credits for server-side build
42
- jobs. The checked-in bundle is produced by `npm ci && npm run build`; source,
43
- tests, lockfile, and exact runtime assets remain in the same Space repository.
 
44
 
45
  ## Browser requirements
46
 
47
  Chrome or Edge with WebGPU is recommended. CPU-WASM fallback requires a
48
- cross-origin-isolated browser with `SharedArrayBuffer`; the Space headers above
49
- enable it. Model storage uses the browser cache/OPFS path exposed by wllama and
50
  requests persistent storage before the first model byte is downloaded. A browser
51
  denial is non-fatal, and the storage panel lets the operator request it again.
52
 
@@ -68,11 +66,10 @@ the browser exposes the required cross-origin-isolated WASM features.
68
 
69
  ## Growth benchmark
70
 
71
- [`?view=bench`](https://wavecut-bonsai-webgpu-chat.static.hf.space/?view=bench)
72
- is a separate, shareable benchmark surface rendered by the root static app.
73
- Hugging Face Static Spaces serve one configured `app_file`, so the query
74
- deep-link keeps the benchmark executable under the same COOP/COEP headers. It
75
- loads nothing until **Run benchmark** is pressed, then records first-load and
76
  verified-cache reload wall time, TTFT,
77
  prefill/decode throughput, graph placement, device limits, engine revisions,
78
  the exact runtime artifact hash, and a fixed temperature-0 prompt. Schema v3
 
3
  emoji: 🌱
4
  colorFrom: green
5
  colorTo: gray
6
+ sdk: docker
7
+ app_port: 7860
8
+ suggested_hardware: cpu-basic
9
  fullWidth: true
10
  short_description: Browser-local Bonsai WebGPU chat with agentic tools
11
  models:
12
  - WaveCut/Bonsai-web-GGUF
 
 
 
 
13
  ---
14
 
15
  # Bonsai WebGPU Chat
 
34
  weight commit `112ea7a1a6229bde132b176b9a72477a7ecfde64`. Every shard has a recorded
35
  byte size and SHA-256.
36
 
37
+ The repository includes the verified `dist/` production bundle. The CPU Basic
38
+ Docker Space serves that bundle directly with Nginx and does not run npm or
39
+ Vite during its container build. The checked-in bundle is produced locally by
40
+ `npm ci && npm run build`; source, tests, lockfile, and exact runtime assets
41
+ remain in the same Space repository.
42
 
43
  ## Browser requirements
44
 
45
  Chrome or Edge with WebGPU is recommended. CPU-WASM fallback requires a
46
+ cross-origin-isolated browser with `SharedArrayBuffer`; the Nginx configuration
47
+ enables it. Model storage uses the browser cache/OPFS path exposed by wllama and
48
  requests persistent storage before the first model byte is downloaded. A browser
49
  denial is non-fatal, and the storage panel lets the operator request it again.
50
 
 
66
 
67
  ## Growth benchmark
68
 
69
+ [`?view=bench`](https://wavecut-bonsai-webgpu-chat.hf.space/?view=bench)
70
+ is a separate, shareable benchmark surface rendered by the same browser app.
71
+ The query deep-link keeps the benchmark executable under the same COOP/COEP
72
+ headers. It loads nothing until **Run benchmark** is pressed, then records first-load and
 
73
  verified-cache reload wall time, TTFT,
74
  prefill/decode throughput, graph placement, device limits, engine revisions,
75
  the exact runtime artifact hash, and a fixed temperature-0 prompt. Schema v3
nginx.conf ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ worker_processes auto;
2
+ pid /tmp/nginx.pid;
3
+ error_log /dev/stderr notice;
4
+
5
+ events {
6
+ worker_connections 1024;
7
+ }
8
+
9
+ http {
10
+ include /etc/nginx/mime.types;
11
+ default_type application/octet-stream;
12
+ access_log /dev/stdout;
13
+ sendfile on;
14
+
15
+ client_body_temp_path /tmp/client_temp;
16
+ proxy_temp_path /tmp/proxy_temp;
17
+ fastcgi_temp_path /tmp/fastcgi_temp;
18
+ uwsgi_temp_path /tmp/uwsgi_temp;
19
+ scgi_temp_path /tmp/scgi_temp;
20
+
21
+ server {
22
+ listen 7860;
23
+ server_name _;
24
+ root /home/user/app;
25
+ index index.html;
26
+
27
+ add_header Cross-Origin-Embedder-Policy "require-corp" always;
28
+ add_header Cross-Origin-Opener-Policy "same-origin" always;
29
+ add_header Cross-Origin-Resource-Policy "cross-origin" always;
30
+
31
+ location = /healthz {
32
+ access_log off;
33
+ default_type text/plain;
34
+ return 200 "ok\n";
35
+ }
36
+
37
+ location / {
38
+ try_files $uri $uri/ /index.html;
39
+ }
40
+ }
41
+ }