Files
altdock/docker-compose.yml
T
amania-jailbreak d4202de0e1 web: vite devサーバーのHost許可リストを設定
Coolifyの公開ドメイン(altdock.app.amania.jp)がvite 8のHostチェックで
403 Blocked requestになるため、VITE_ALLOWED_HOSTSで許可ホストを
環境変数から設定できるようにした。composeのデフォルトは
altdock.app.amania.jp、カンマ区切り複数対応、* で全許可。
2026-08-05 13:42:35 +09:00

127 lines
4.4 KiB
YAML

# AltDock full stack. Works locally with `docker compose up` and on Coolify,
# where you override the `${VAR:-default}` values from the project's
# Environment Variables / secrets panel.
#
# Coolify notes:
# - web/api/worker are all built from the same root Dockerfile and run from
# the image contents. There are no bind mounts, so nothing depends on
# Coolify mounting the git repository at /workspace (relative paths are
# mounted as empty named volumes there).
# - node_modules is baked into the image once by `npm ci` at build time, so
# the containers never race each other running npm install.
# - MinIO is fully private: uploads always flow through the API (browser ->
# API -> MinIO) and the API creates its bucket on startup, so no
# minio-init container and no published MinIO ports/domain are required.
# - postgres published port exists only for local development; on Coolify,
# public traffic goes through its reverse proxy and MinIO stays internal.
x-altdock-app: &altdock-app
build:
context: .
dockerfile: Dockerfile
working_dir: /workspace
restart: unless-stopped
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: ${POSTGRES_DB:-altdock}
POSTGRES_USER: ${POSTGRES_USER:-altdock}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-altdock}
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-altdock} -d ${POSTGRES_DB:-altdock}"]
interval: 5s
timeout: 5s
retries: 10
minio:
image: minio/minio:latest
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin123}
# Internal-only: the API reaches MinIO over the compose network and uploads
# are proxied through the API, so no host ports / public domain are needed.
expose:
- "9000"
- "9001"
volumes:
- minio-data:/data
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 5s
timeout: 5s
retries: 12
start_period: 10s
api:
<<: *altdock-app
command: sh -c "npm run db:migrate && exec npm run dev:api"
environment:
PORT: 4000
DATABASE_URL: postgres://${POSTGRES_USER:-altdock}:${POSTGRES_PASSWORD:-altdock}@postgres:5432/${POSTGRES_DB:-altdock}
STORAGE_MODE: s3
# Internal address only; uploads are proxied through the API, so MinIO
# never needs a public URL.
S3_ENDPOINT: http://minio:9000
S3_REGION: ${S3_REGION:-us-east-1}
S3_BUCKET: ${S3_BUCKET:-altdock}
S3_ACCESS_KEY_ID: ${MINIO_ROOT_USER:-minioadmin}
S3_SECRET_ACCESS_KEY: ${MINIO_ROOT_PASSWORD:-minioadmin123}
S3_FORCE_PATH_STYLE: "true"
AUTH_MODE: ${AUTH_MODE:-demo}
PROCESS_INLINE: "false"
PUBLIC_BASE_URL: ${PUBLIC_BASE_URL:-http://localhost:4000}
WEB_ORIGIN: ${WEB_ORIGIN:-http://localhost:3001}
ports:
- "4000:4000"
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
worker:
<<: *altdock-app
command: npm run dev:worker
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-altdock}:${POSTGRES_PASSWORD:-altdock}@postgres:5432/${POSTGRES_DB:-altdock}
STORAGE_MODE: s3
S3_ENDPOINT: http://minio:9000
S3_REGION: ${S3_REGION:-us-east-1}
S3_BUCKET: ${S3_BUCKET:-altdock}
S3_ACCESS_KEY_ID: ${MINIO_ROOT_USER:-minioadmin}
S3_SECRET_ACCESS_KEY: ${MINIO_ROOT_PASSWORD:-minioadmin123}
S3_FORCE_PATH_STYLE: "true"
AUTH_MODE: ${AUTH_MODE:-demo}
PROCESS_INLINE: "false"
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
web:
<<: *altdock-app
# vinext uses --hostname/--port (not vite's --host) to bind the dev server.
command: npm run dev -- --hostname 0.0.0.0 --port 3001
environment:
NEXT_PUBLIC_API_BASE_URL: ${NEXT_PUBLIC_API_BASE_URL:-http://localhost:4000}
NEXT_PUBLIC_AUTH_MODE: ${AUTH_MODE:-demo}
# Hosts allowed to reach the dev server (comma-separated, or * for any).
VITE_ALLOWED_HOSTS: ${VITE_ALLOWED_HOSTS:-altdock.app.amania.jp}
ports:
- "3001:3001"
depends_on:
api:
condition: service_started
volumes:
postgres-data:
minio-data: