|
|
@@ -41,6 +41,60 @@ Browser access: http://127.0.0.1:5173/
|
|
|
> Note: If you deploy this project on your own server and find that it fails to initialize, it's because the initialization data is stored in the author's private object storage and is not publicly accessible. You'll need to transfer the data to your own server, object storage service, database, or front-end local storage.
|
|
|
|
|
|
|
|
|
+# 🐳 Docker Deployment
|
|
|
+
|
|
|
+Packaged as a static nginx image. **The image contains no environment-specific values and no credentials** — all configuration is injected at container startup, so the same image runs in any environment and changing configuration never requires a rebuild.
|
|
|
+
|
|
|
+### Build
|
|
|
+
|
|
|
+```bash
|
|
|
+docker build --platform linux/arm64 -t pptist:2.0.0 .
|
|
|
+```
|
|
|
+
|
|
|
+`--platform` determines the target architecture. Check with `uname -m` first: `aarch64` → `linux/arm64`, `x86_64` → `linux/amd64`. A mismatch leaves the operator with nothing but `exec format error` after `docker load`.
|
|
|
+
|
|
|
+### Run
|
|
|
+
|
|
|
+```bash
|
|
|
+docker run -d --name pptist -p 8080:80 \
|
|
|
+ -e SPEAKING_API_HOST=https://your-api-host \
|
|
|
+ -e AZURE_SPEECH_KEY=xxxxxxxx \
|
|
|
+ -e AZURE_SPEECH_REGION=eastasia \
|
|
|
+ -e TZ=Asia/Shanghai \
|
|
|
+ pptist:2.0.0
|
|
|
+```
|
|
|
+
|
|
|
+### Configuration
|
|
|
+
|
|
|
+| Variable | Required | Description |
|
|
|
+| --- | :---: | --- |
|
|
|
+| `SPEAKING_API_HOST` | ✅ | Backend API address. **Must be reachable from the browser** (public domain or `http://server-ip:8000`) — a container name will not work. If omitted, falls back to the domain hardcoded in the source |
|
|
|
+| `AZURE_SPEECH_KEY` | ✅ | Azure Speech key, used by the frontend for TTS playback. Without it, playback throws |
|
|
|
+| `AZURE_SPEECH_REGION` | ✅ | Azure region, e.g. `eastasia` |
|
|
|
+| `TZ` | | Timezone. Defaults to UTC, affects nginx log timestamps only |
|
|
|
+
|
|
|
+> ⚠️ `AZURE_SPEECH_KEY` is written into `/config.js`, which is readable by anyone in the browser. This is inherited from the existing design (the frontend calls Azure directly); moving to runtime injection improved flexibility, not security.
|
|
|
+
|
|
|
+### Verify
|
|
|
+
|
|
|
+```bash
|
|
|
+curl http://localhost:8080/config.js
|
|
|
+```
|
|
|
+
|
|
|
+All three values should be non-empty. An empty value means that environment variable was not passed in; the output carries an explanatory comment.
|
|
|
+
|
|
|
+### Changing configuration
|
|
|
+
|
|
|
+Re-run the container with new `-e` flags — **no rebuild required**:
|
|
|
+
|
|
|
+```bash
|
|
|
+docker rm -f pptist
|
|
|
+docker run -d --name pptist -p 8080:80 -e SPEAKING_API_HOST=... pptist:2.0.0
|
|
|
+```
|
|
|
+
|
|
|
+How it works: on startup nginx renders `config.js.template` into `/config.js` via `envsubst`, and the page loads it synchronously before the app bundle. The lookup order in code is `window.__APP_CONFIG__` > `import.meta.env.VITE_*` > hardcoded fallback, so local `npm run dev` and the existing non-container build behave exactly as before.
|
|
|
+
|
|
|
+
|
|
|
# 📚 Features
|
|
|
### Basic Features
|
|
|
- History (undo, redo)
|