updated 3 tier structure
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
# Dev-sidecar compose: app container + PostgreSQL sidecar.
|
||||
# Used by .devcontainer/devcontainer.json via dockerComposeFile.
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: .devcontainer/Dockerfile
|
||||
restart: "no"
|
||||
ports:
|
||||
- "8000:8000" # FastAPI
|
||||
- "4200:4200" # Angular dev server
|
||||
environment:
|
||||
KMTN_DATABASE_URL: postgresql+asyncpg://postgres:postgres@db:5432/kmountain
|
||||
KMTN_CORS_ORIGINS: '["http://localhost:4200"]'
|
||||
volumes:
|
||||
- ..:/workspaces/web_app:cached
|
||||
- node_modules:/workspaces/web_app/node_modules
|
||||
- backend_venv:/app/.venv
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
command: >
|
||||
sh -c "
|
||||
pip install -r backend/requirements.txt &&
|
||||
cd backend &&
|
||||
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload &
|
||||
cd /workspaces/web_app &&
|
||||
npm install &&
|
||||
npx ng serve --host 0.0.0.0 --port 4200
|
||||
"
|
||||
|
||||
db:
|
||||
image: docker.io/library/postgres:16-alpine
|
||||
restart: "no"
|
||||
environment:
|
||||
POSTGRES_DB: kmountain
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
node_modules:
|
||||
backend_venv:
|
||||
Reference in New Issue
Block a user