forked from syntaxbullet/aurorabot
feat: Overhaul Docker infrastructure with multi-stage builds, add a cleanup script, and refactor the update service to combine update and requirement checks.
This commit is contained in:
@@ -10,8 +10,8 @@ services:
|
||||
# ports:
|
||||
# - "127.0.0.1:${DB_PORT}:5432"
|
||||
volumes:
|
||||
# Host-mounted to preserve existing VPS data
|
||||
- ./shared/db/data:/var/lib/postgresql/data
|
||||
- ./shared/db/log:/var/log/postgresql
|
||||
networks:
|
||||
- internal
|
||||
healthcheck:
|
||||
@@ -23,17 +23,19 @@ services:
|
||||
app:
|
||||
container_name: aurora_app
|
||||
restart: unless-stopped
|
||||
image: aurora-app
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
target: development # Use development stage
|
||||
working_dir: /app
|
||||
ports:
|
||||
- "127.0.0.1:3000:3000"
|
||||
volumes:
|
||||
# Mount source code for hot reloading
|
||||
- .:/app
|
||||
- /app/node_modules
|
||||
- /app/web/node_modules
|
||||
# Use named volumes for node_modules (prevents host overwrite + caches deps)
|
||||
- app_node_modules:/app/node_modules
|
||||
- web_node_modules:/app/web/node_modules
|
||||
environment:
|
||||
- HOST=0.0.0.0
|
||||
- DB_USER=${DB_USER}
|
||||
@@ -61,30 +63,20 @@ services:
|
||||
|
||||
studio:
|
||||
container_name: aurora_studio
|
||||
image: aurora-app
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
working_dir: /app
|
||||
# Reuse the same built image as app (no duplicate builds!)
|
||||
extends:
|
||||
service: app
|
||||
ports:
|
||||
- "127.0.0.1:4983:4983"
|
||||
volumes:
|
||||
- .:/app
|
||||
- /app/node_modules
|
||||
- /app/web/node_modules
|
||||
environment:
|
||||
- DB_USER=${DB_USER}
|
||||
- DB_PASSWORD=${DB_PASSWORD}
|
||||
- DB_NAME=${DB_NAME}
|
||||
- DB_PORT=5432
|
||||
- DB_HOST=db
|
||||
- DATABASE_URL=postgresql://${DB_USER}:${DB_PASSWORD}@db:5432/${DB_NAME}
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- internal
|
||||
- web
|
||||
# Override healthcheck since studio doesn't serve on port 3000
|
||||
healthcheck:
|
||||
test: [ "CMD", "bun", "-e", "fetch('http://localhost:4983').then(r => process.exit(0)).catch(() => process.exit(1))" ]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
# Disable restart for studio (it's an on-demand tool)
|
||||
restart: "no"
|
||||
command: [ "bun", "x", "drizzle-kit", "studio", "--port", "4983", "--host", "0.0.0.0" ]
|
||||
|
||||
networks:
|
||||
@@ -93,3 +85,10 @@ networks:
|
||||
internal: true # No external access
|
||||
web:
|
||||
driver: bridge # Can be accessed from host
|
||||
|
||||
volumes:
|
||||
# Named volumes for node_modules caching
|
||||
app_node_modules:
|
||||
name: aurora_app_node_modules
|
||||
web_node_modules:
|
||||
name: aurora_web_node_modules
|
||||
|
||||
Reference in New Issue
Block a user