feat(deploy): dev/prod Dockerfiles in service dirs (backend/,web/), templates live beside rendered outputs, entrypoint copies /etc/booklib conf before resolver injection
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
# release:编译产物、无源码挂载、infra 端口不出宿主机
|
||||
name: booklib
|
||||
services:
|
||||
web:
|
||||
build: { context: .., dockerfile: web/Dockerfile.prod, target: runner }
|
||||
ports: ["${WEB_PORT:-8080}:80"]
|
||||
volumes:
|
||||
- ./nginx/nginx.conf:/etc/booklib/nginx.conf:ro
|
||||
- ./nginx/conf.d/default.conf:/etc/booklib/default.conf:ro
|
||||
- ./logs/nginx:/var/log/nginx
|
||||
depends_on: [api]
|
||||
api:
|
||||
build: { context: .., dockerfile: backend/Dockerfile.prod, target: runner }
|
||||
environment:
|
||||
DATABASE_URL: postgres://lib:lib@postgres:5432/lib?sslmode=disable
|
||||
REDIS_URL: redis://redis:6379
|
||||
JWT_SECRET: ${JWT_SECRET}
|
||||
ADMIN_USER: ${ADMIN_USER}
|
||||
ADMIN_PASSWORD: ${ADMIN_PASSWORD}
|
||||
BOOKS_DIR: /data/books
|
||||
CACHE_DIR: /data/books/cache
|
||||
SCAN_INTERVAL_SEC: ${SCAN_INTERVAL_SEC:-60}
|
||||
volumes:
|
||||
- ./api/storage:/data/books
|
||||
depends_on:
|
||||
postgres: { condition: service_healthy }
|
||||
redis: { condition: service_started }
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
environment: { POSTGRES_USER: lib, POSTGRES_PASSWORD: lib, POSTGRES_DB: lib }
|
||||
volumes: [postgres_data:/var/lib/postgresql/data]
|
||||
healthcheck: { test: ["CMD-SHELL", "pg_isready -U lib"], interval: 2s, timeout: 2s, retries: 30 }
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
|
||||
volumes:
|
||||
- ./redis/redis.conf:/usr/local/etc/redis/redis.conf:ro
|
||||
- redis_data:/data
|
||||
volumes:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
Reference in New Issue
Block a user