upatde: add docker for coolify
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# upload-GLTF
|
||||
|
||||
A secure web interface for uploading 3D assets (GLTF/GLB + textures) and automatically pushing them to a GitHub repository via the GitHub API. Built for La Fabrik Durable.
|
||||
A secure web interface for uploading 3D assets (GLTF/GLB + textures) with automatic Draco compression and GitHub push. Built for La Fabrik Durable.
|
||||
|
||||
## Stack
|
||||
|
||||
@@ -8,7 +8,8 @@ A secure web interface for uploading 3D assets (GLTF/GLB + textures) and automat
|
||||
- **Three.js** (@react-three/fiber + @react-three/drei) for 3D preview
|
||||
- **Tailwind CSS** for styling
|
||||
- **Octokit** for pushing via the GitHub API
|
||||
- **Vercel** for hosting
|
||||
- **Blender** (headless) for Draco mesh compression
|
||||
- **Coolify** (Docker) for hosting
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -35,6 +36,7 @@ GIT_REPO_URL=https://github.com/your-org/your-repo.git
|
||||
| `GITHUB_TOKEN` | GitHub Personal Access Token (scope `repo`) | Yes |
|
||||
| `GIT_BRANCH` | Target branch (default: main) | No |
|
||||
| `GIT_REPO_URL` | Target GitHub repository URL | Yes |
|
||||
| `BLENDER_PATH` | Path to Blender binary (default: `blender`) | No |
|
||||
|
||||
> To create a token: GitHub > Settings > Developer settings > Personal access tokens > Generate new token (classic) with the `repo` scope.
|
||||
|
||||
@@ -48,9 +50,20 @@ npm run dev
|
||||
|
||||
Access the app at `http://localhost:3000`
|
||||
|
||||
### Production (Vercel)
|
||||
> **Note:** Draco compression requires Blender installed locally. If Blender is not available, models are pushed to GitHub without compression.
|
||||
|
||||
Deploy to Vercel and configure environment variables in the dashboard.
|
||||
### Production (Coolify / Docker)
|
||||
|
||||
```bash
|
||||
docker build -t upload-gltf .
|
||||
docker run -p 3000:3000 \
|
||||
-e UPLOAD_SECRET_KEY=your-key \
|
||||
-e GITHUB_TOKEN=ghp_xxx \
|
||||
-e GIT_REPO_URL=https://github.com/org/repo.git \
|
||||
upload-gltf
|
||||
```
|
||||
|
||||
The Dockerfile includes Blender headless for automatic Draco compression.
|
||||
|
||||
## How it works
|
||||
|
||||
@@ -60,13 +73,15 @@ Deploy to Vercel and configure environment variables in the dashboard.
|
||||
- Textures: `roughness`, `normal`, `metalness`, `color`, `displace` (`.png/.jpg/.webp`, optional)
|
||||
3. The model is displayed in a 3D preview
|
||||
4. On clicking "Upload & Push to GitHub", each file is sent to the `/api/upload` endpoint
|
||||
5. The API validates the file and pushes it directly to the GitHub repo via the API (no git CLI needed)
|
||||
5. For models: the file is written to `/tmp`, compressed with Blender Draco, then the compressed version is pushed to GitHub
|
||||
6. For textures: pushed directly to GitHub without compression
|
||||
7. If Blender is unavailable, the original model is pushed as-is (graceful fallback)
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
app/
|
||||
├── api/upload/route.ts # API: validation + GitHub push via Octokit
|
||||
├── api/upload/route.ts # API: validation + Draco compression + GitHub push
|
||||
├── globals.css # Tailwind + Google Fonts
|
||||
├── layout.tsx # Root layout
|
||||
└── page.tsx # Home page
|
||||
@@ -74,6 +89,8 @@ components/
|
||||
├── UploadZone.tsx # UI: key input, folder picker, validation, upload
|
||||
├── ModelViewer.tsx # Lazy wrapper for the 3D viewer
|
||||
└── SceneViewer.tsx # Three.js Canvas
|
||||
scripts/
|
||||
└── compress.py # Blender Draco compression script
|
||||
```
|
||||
|
||||
## Supported Formats
|
||||
|
||||
Reference in New Issue
Block a user