upatde: dockerfile init blender
This commit is contained in:
@@ -64,23 +64,27 @@ docker run -p 3000:3000 \
|
||||
upload-gltf
|
||||
```
|
||||
|
||||
The Dockerfile includes Blender headless for automatic Draco compression.
|
||||
The Docker image includes Blender headless (installed once at build time). On startup, the entrypoint checks if Blender is available and logs its version. No extra configuration is needed in production — `BLENDER_PATH` defaults to `blender` which is in the container's PATH.
|
||||
|
||||
## How it works
|
||||
|
||||
1. The user enters their access key
|
||||
2. They pick a **destination** (`farm`, `map`, `powergrid`, `workshop`, `general`, `environment`)
|
||||
3. They select a folder containing:
|
||||
- `model.glb` or `model.gltf` (required)
|
||||
- Textures: `roughness`, `normal`, `metalness`, `color`, `displace` (`.png/.jpg/.webp`, optional)
|
||||
- `model.glb` or `model.gltf` (**required**)
|
||||
- Textures: `roughness`, `normal`, `metalness`, `color`, `displace` (`.png/.jpg/.webp`, **optional** — missing textures show a warning but don't block the upload)
|
||||
4. The model is displayed in a 3D preview
|
||||
5. On clicking "Envoyer sur GitHub":
|
||||
- The app checks if the folder already exists on the remote repo
|
||||
- If it exists, a confirmation dialog is shown listing the existing files that will be replaced
|
||||
- On confirmation (or if the folder is new), all files are sent to the `/api/upload` endpoint
|
||||
- The app computes the git SHA of each local file and compares with the remote repo
|
||||
- If the folder doesn't exist, upload proceeds directly
|
||||
- If the folder exists and files differ, a confirmation dialog shows **only the actual changes** (modified, new, or deleted files)
|
||||
- If the folder exists and nothing changed, the upload is skipped entirely ("Aucun fichier modifie")
|
||||
6. For models: the file is written to `/tmp`, compressed with Blender Draco, then the compressed version is pushed
|
||||
7. For textures: pushed directly without compression
|
||||
8. All files are pushed in a **single commit** with a formatted message:
|
||||
8. **Only changed and new files are pushed** — unchanged files are skipped to save bandwidth and API calls
|
||||
9. All changes are pushed in a **single commit** with a formatted message that only lists what changed:
|
||||
|
||||
**New folder:**
|
||||
```
|
||||
update: upload-gltf add a new model -> farm/my-model
|
||||
|
||||
@@ -90,8 +94,19 @@ The Dockerfile includes Blender headless for automatic Draco compression.
|
||||
✅ color.jpg
|
||||
❌ metalness (manquant)
|
||||
```
|
||||
9. If the folder already existed, orphan files (present in the old version but not in the new upload) are deleted in the same commit
|
||||
10. If Blender is unavailable, the original model is pushed as-is (graceful fallback)
|
||||
|
||||
**Update (only metalness changed):**
|
||||
```
|
||||
update: upload-gltf update -> general/coffeetest
|
||||
|
||||
🎨 Textures
|
||||
🔄 metalness.jpg
|
||||
```
|
||||
|
||||
Symbols: `✅` new — `🔄` modified — `❌` missing or deleted
|
||||
|
||||
10. Orphan files (present on remote but not in the new upload) are deleted in the same commit
|
||||
11. If Blender is unavailable, the original model is pushed as-is (graceful fallback)
|
||||
|
||||
## Destinations
|
||||
|
||||
@@ -110,16 +125,18 @@ Uploaded models are pushed to `public/models/<destination>/<folderName>/` in the
|
||||
|
||||
```
|
||||
app/
|
||||
├── api/upload/route.ts # API: GET (check existence) + POST (compress + push)
|
||||
├── api/upload/route.ts # API: GET (check + SHA diff) + POST (compress + smart push)
|
||||
├── globals.css # Tailwind + Google Fonts
|
||||
├── layout.tsx # Root layout
|
||||
└── page.tsx # Home page
|
||||
components/
|
||||
├── UploadZone.tsx # UI: key input, destination picker, folder picker, validation, overwrite confirmation, upload
|
||||
├── UploadZone.tsx # UI: key input, destination picker, folder picker, SHA diff, overwrite confirmation, upload
|
||||
├── ModelViewer.tsx # Lazy wrapper for the 3D viewer
|
||||
└── SceneViewer.tsx # Three.js Canvas
|
||||
scripts/
|
||||
└── compress.py # Blender Draco compression script
|
||||
Dockerfile # Multi-stage build: Node 20 slim + Blender headless + tini
|
||||
docker-entrypoint.sh # Startup: Blender check + launch
|
||||
```
|
||||
|
||||
## Supported Formats
|
||||
|
||||
Reference in New Issue
Block a user