feat(docker): add single-image multi-stage Docker setup with compose
- Multi-stage build: Node builds the frontend, Go builds a static CGO-free binary, runtime is Alpine with CA certificates - Add docker-compose.yml with persistent volume for the SQLite database - Add .dockerignore to keep the build context slim - Embed time/tzdata in the Go binary for OS-independent timezones - Document image build, startup, secrets, and reverse-proxy setup in README
This commit is contained in:
parent
cbc03c56bf
commit
38ab90f721
5 changed files with 115 additions and 0 deletions
32
README.md
32
README.md
|
|
@ -60,6 +60,38 @@ go run ./cmd/server
|
|||
|
||||
Der Go-Server liefert dann das Frontend (`dist/`) **und** die API über einen Port.
|
||||
|
||||
## Docker (alles in einem Image)
|
||||
|
||||
Multi-Stage-Build: Node baut das Frontend, Go ein statisches Binary (CGO-frei dank modernc-SQLite), Laufzeit ist Alpine mit CA-Zertifikaten (für Google-/CalDAV-/ICS-HTTPS-Aufrufe). Frontend liegt im Image unter `/app/dist` und wird vom Go-Server mit ausgeliefert — **ein Port, ein Container, eine URL.**
|
||||
|
||||
```bash
|
||||
# Image bauen
|
||||
docker build -t wannpassts .
|
||||
|
||||
# Starten (Datenbank im Volume, damit sie Updates überlebt)
|
||||
docker run -d --name wannpassts -p 8080:8080 \
|
||||
-e JWT_SECRET=$(openssl rand -hex 32) \
|
||||
-e ENCRYPTION_KEY=$(openssl rand -hex 32) \
|
||||
-v wannpassts-data:/data \
|
||||
wannpassts
|
||||
```
|
||||
|
||||
Oder mit Compose (liest Secrets aus `.env` im Projektroot bzw. `backend/.env`):
|
||||
|
||||
```bash
|
||||
cp backend/.env.example backend/.env # Secrets & Google-Zugänge eintragen
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
Hinter einem Reverse-Proxy / mit Domain zusätzlich setzen:
|
||||
|
||||
```bash
|
||||
-e APP_URL=https://termine.deinedomain.de \
|
||||
-e FRONTEND_URL=https://termine.deinedomain.de
|
||||
```
|
||||
|
||||
Wichtig: `JWT_SECRET` und `ENCRYPTION_KEY` dauerhaft setzen (Container-Neustarts sonst neue Secrets → Logins/Token ungültig), und die Google-Redirect-URI auf `{APP_URL}/api/calendars/google/callback` konfigurieren. Das SQLite-File liegt im Volume `/data`.
|
||||
|
||||
### PWA-Hinweise
|
||||
|
||||
- Der Service Worker wird nur im Production-Build registriert (`npm run build` + Auslieferung über `STATIC_DIR`), nicht im Vite-Dev-Modus.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue