All checks were successful
Build and Release / build-and-release (push) Successful in 15m24s
3.4 KiB
3.4 KiB
Deploy — Self-Updating Docker Container
A single Docker container that serves the web app and auto-rebuilds when it receives a webhook from Gitea. Designed for Unraid with a Pangolin reverse proxy.
How It Works
The container runs a Node.js server that:
- Serves the built Vite SPA with gzip compression and proper caching
- Listens for
POST /api/webhookcalls (auth handled by Pangolin) - On webhook: clones the repo, installs deps, builds, and hot-swaps the served files with zero downtime
- On first start: auto-builds if no previous release exists
Quick Start
1. Build the image
From the project root (not deploy/):
docker build -f deploy/Dockerfile -t moyettes/brycord .
2. Run the container
docker run -d \
--name moyettes/brycord \
-p 3000:3000 \
-e GIT_REPO_URL=https://gitea.example.com/user/discord-clone.git \
-e VITE_CONVEX_URL=https://your-convex-deployment.convex.cloud \
-e VITE_LIVEKIT_URL=wss://your-livekit-server.com \
discord-clone-web
The container will clone the repo and build on first start. Watch progress with:
docker logs -f discord-clone-web
Once the build completes, visit http://localhost:3000.
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
GIT_REPO_URL |
Yes | Git repository URL to clone | |
GIT_BRANCH |
No | main |
Branch to build |
VITE_CONVEX_URL |
Yes | Convex backend URL | |
VITE_LIVEKIT_URL |
Yes | LiveKit WebSocket URL | |
PORT |
No | 3000 |
Server port |
API Endpoints
POST /api/webhook
Triggers a new build. Auth is handled by Pangolin reverse proxy.
curl -X POST http://localhost:3000/api/webhook
Responses:
200— Build triggered409— Build already in progress
GET /api/status
Returns current build status. No auth required.
curl http://localhost:3000/api/status
Response:
{
"building": false,
"status": "success",
"timestamp": 1708531200000,
"error": null
}
status is one of: idle, building, success, failed.
Unraid Setup
- Build the image (or push to a registry and pull from there)
- In the Unraid Docker UI, create a new container:
- Repository:
discord-clone-web - Port mapping: 3000 -> 3000
- Add each environment variable listed above
- Repository:
- Start the container and wait for the initial build to finish
Gitea Webhook Setup
- In your Gitea repo, go to Settings > Webhooks > Add Webhook > Gitea
- Configure:
- Target URL:
https://your-domain.com/api/webhook - HTTP Method: POST
- Content Type: application/json
- Trigger On: Push Events
- Branch filter:
main
- Target URL:
- Click Add Webhook, then Test Delivery to verify
Auth for the webhook endpoint is handled by Pangolin's HTTP Header Auth.
Rebuild Manually
Trigger a rebuild at any time without pushing code:
curl -X POST http://localhost:3000/api/webhook
Failure Handling
- Build fails: temp files are cleaned up, the previous version keeps serving, error is logged and visible via
/api/status - Clone fails: same as above — old version stays live
- Concurrent webhooks: second request gets
409, only one build runs at a time - Container restart: serves the most recent release from
/app/releases/, or triggers a fresh build if empty