postgres va shu imagelarni birga run qilish uchun Docker-compose.yml file:
version: '3.8'
services:
app:
build: .
ports:
- "3000:4001"
environment:
DATABASE_URL: "postgresql://postgres:password@db:5432/yourdb?schema=public"
depends_on:
db:
condition: service_healthy
restart: always
command: sh -c "npx prisma migrate deploy && npm run start:prod"
db:
image: postgres:14-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: yourdb
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
volumes:
postgres-data:
@practical_coders
version: '3.8'
services:
app:
build: .
ports:
- "3000:4001"
environment:
DATABASE_URL: "postgresql://postgres:password@db:5432/yourdb?schema=public"
depends_on:
db:
condition: service_healthy
restart: always
command: sh -c "npx prisma migrate deploy && npm run start:prod"
db:
image: postgres:14-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: yourdb
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
volumes:
postgres-data:
@practical_coders