Finalize template
This commit is contained in:
63
docker-compose.yml
Normal file
63
docker-compose.yml
Normal file
@@ -0,0 +1,63 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:18-alpine
|
||||
environment:
|
||||
POSTGRES_USER: webapp
|
||||
POSTGRES_PASSWORD: webpass
|
||||
POSTGRES_DB: webappdb
|
||||
PGDATA: /var/lib/postgresql/data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- webapp_pgdata:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U webapp -d webappdb"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
api:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./apps/api/Dockerfile.dev
|
||||
command: sh -c "pnpm install && pnpm prisma generate && pnpm prisma migrate deploy && pnpm nx serve api"
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- DATABASE_URL=postgresql://webapp:webpass@db:5432/webappdb
|
||||
- NX_DAEMON=false
|
||||
- NX_WORKSPACE_DATA_DIRECTORY=/tmp/nx-workspace-data-api
|
||||
- NX_CACHE_DIRECTORY=/tmp/nx-cache-api
|
||||
stop_grace_period: 5s
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- .:/app
|
||||
- api_node_modules:/app/node_modules
|
||||
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./apps/web-app/Dockerfile.dev
|
||||
command: sh -c "pnpm install && pnpm nx serve web-app --host 0.0.0.0 --port 4200"
|
||||
ports:
|
||||
- "4200:4200"
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- NX_DAEMON=false
|
||||
- NX_WORKSPACE_DATA_DIRECTORY=/tmp/nx-workspace-data-web
|
||||
- NX_CACHE_DIRECTORY=/tmp/nx-cache-web
|
||||
stop_grace_period: 5s
|
||||
volumes:
|
||||
- .:/app
|
||||
- web_node_modules:/app/node_modules
|
||||
depends_on:
|
||||
api:
|
||||
condition: service_started
|
||||
|
||||
volumes:
|
||||
webapp_pgdata:
|
||||
api_node_modules:
|
||||
web_node_modules:
|
||||
Reference in New Issue
Block a user