docs: add docker compose quickstart

This commit is contained in:
William Valentin
2025-09-23 11:32:48 -07:00
parent eb43766b21
commit dec8c7b42e
5 changed files with 77 additions and 1 deletions

View File

@@ -236,7 +236,17 @@ The application automatically selects the appropriate database strategy:
## 🐳 Docker Development
### **Build and Run**
### **Docker Compose Quickstart**
```bash
docker compose up --build
```
- Serves the production build at [http://localhost:8080](http://localhost:8080)
- Spins up CouchDB at [http://localhost:5984](http://localhost:5984) using credentials from `.env`
- Applies CORS settings from `couchdb-config/cors.ini` (update the allowed `origins` for custom domains)
### **Manual Build and Run**
```bash
# Build Docker image

8
couchdb-config/cors.ini Normal file
View File

@@ -0,0 +1,8 @@
[chttpd]
enable_cors = true
[cors]
origins = http://localhost:8080, http://localhost:5173
credentials = true
methods = GET, PUT, POST, HEAD, DELETE, OPTIONS
headers = accept, authorization, content-type, origin, referer, cache-control, x-requested-with

16
couchdb-config/docker.ini Normal file
View File

@@ -0,0 +1,16 @@
[admins]
admin = -pbkdf2:sha256-c9a393efac86b8a234ad91c5f7dd5a3d057ea7b76aad8b0194b41ff64ee80ec5,cab6f942a2c7d4ff7e5d54010475b7a2,600000
[couchdb]
uuid = 2083849204f5378942a1abfff8ef20cf
[chttpd_auth]
secret = 4e4abcc9cae38e179910098ad7f2f2e4
[chttpd]
bind_address = 0.0.0.0
port = 5984
[cluster]
n = 1

40
docker-compose.yaml Normal file
View File

@@ -0,0 +1,40 @@
version: '3.8'
services:
couchdb:
image: couchdb:3
container_name: meds-couchdb
env_file:
- .env
environment:
COUCHDB_USER: ${COUCHDB_USER:-admin}
COUCHDB_PASSWORD: ${COUCHDB_PASSWORD:-change-this-secure-password}
ports:
- '5984:5984'
volumes:
- couchdb-data:/opt/couchdb/data
- ./couchdb-config:/opt/couchdb/etc/local.d
restart: unless-stopped
frontend:
build:
context: .
dockerfile: Dockerfile
args:
NODE_ENV: ${NODE_ENV:-production}
VITE_COUCHDB_URL: ${VITE_COUCHDB_URL:-http://localhost:5984}
VITE_COUCHDB_USER: ${VITE_COUCHDB_USER:-admin}
VITE_COUCHDB_PASSWORD: ${VITE_COUCHDB_PASSWORD:-change-this-secure-password}
VITE_ADMIN_EMAIL: ${VITE_ADMIN_EMAIL:-admin@localhost}
VITE_ADMIN_PASSWORD: ${VITE_ADMIN_PASSWORD:-admin123!}
env_file:
- .env
depends_on:
- couchdb
ports:
- '8080:80'
restart: unless-stopped
volumes:
couchdb-data:
name: meds-couchdb-data

View File

@@ -225,6 +225,8 @@ DEV_API_URL=http://localhost:5984
| `CERT_MANAGER_ISSUER` | `letsencrypt-prod` | Certificate issuer |
| `CORS_ORIGIN` | `*` | CORS allowed origins |
> When running via `docker compose up --build`, CouchDB CORS settings are sourced from `couchdb-config/cors.ini`. Update the `origins` list in that file to add additional frontend domains.
### Performance Variables
| Variable | Default | Description |