Files
lifeforge/docker-compose.yaml
Melvin Chia 9bc717bbf5 feat(client,server,db): restructure docker setup, add db-init and client-builder services
feat(db): implement db-init container for migration generation and application
feat(client): create client-builder for on-demand client rebuilds
refactor(server): optimize Dockerfile and entrypoint for better build process
refactor(tools): enhance module install/uninstall with Docker reload options
fix(tools): prevent migration history-sync in Docker mode
feat(tools): add docker management commands for reload functionality
2026-01-07 18:47:22 +08:00

101 lines
2.2 KiB
YAML

services:
db:
build:
context: .
dockerfile: docker/db/Dockerfile
container_name: lifeforge-db
restart: unless-stopped
env_file:
- ./env/.env.docker
environment:
- DOCKER_MODE=true
- PB_BINARY_PATH=/usr/local/bin/pocketbase
- PB_DIR=/pb_data
expose:
- "8090"
volumes:
- ./database/pb_data:/pb_data
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:8090/api/health || exit 1
interval: 5s
timeout: 5s
retries: 5
start_period: 10s
db-init:
build:
context: .
dockerfile: docker/db-init/Dockerfile
container_name: lifeforge-db-init
env_file:
- ./env/.env.docker
environment:
- DOCKER_MODE=true
- PB_DIR=/pb_data
- PB_HOST=http://db:8090
volumes:
- ./database/pb_data:/pb_data
- ./apps:/app/apps
- ./locales:/app/locales
depends_on:
db:
condition: service_healthy
server:
build:
context: .
dockerfile: docker/server/Dockerfile
container_name: lifeforge-server
restart: unless-stopped
env_file:
- ./env/.env.docker
environment:
- DOCKER_MODE=true
- NODE_ENV=production
- PB_HOST=http://db:8090
expose:
- "3636"
volumes:
- ./apps:/lifeforge/apps
- ./locales:/lifeforge/locales
depends_on:
db-init:
condition: service_completed_successfully
client-builder:
build:
context: .
dockerfile: docker/client-builder/Dockerfile
args:
- VITE_API_HOST=/api
container_name: lifeforge-client-builder
environment:
- DOCKER_MODE=true
- VITE_API_HOST=/api
volumes:
- ./apps:/app/apps
- ./locales:/app/locales
- client-dist:/output
depends_on:
db-init:
condition: service_completed_successfully
client:
build:
context: .
dockerfile: docker/client/Dockerfile
container_name: lifeforge-client
restart: unless-stopped
ports:
- "80:80"
volumes:
- client-dist:/usr/share/nginx/html
depends_on:
client-builder:
condition: service_completed_successfully
server:
condition: service_started
volumes:
client-dist: