add docker compose

This commit is contained in:
AmirHossein Mahmoodi
2025-05-04 10:20:45 +03:30
parent 0274875022
commit 1224a8dfbf
2 changed files with 45 additions and 6 deletions

39
docker-compose.yml Normal file
View File

@@ -0,0 +1,39 @@
version: '3.9'
services:
app:
build:
context: .
dockerfile: Dockerfile
container_name: nestjs-app
environment:
- NODE_ENV=production
- DB_HOST=${POSTGRES_HOST}
- DB_PORT=${POSTGRES_PORT}
- DB_USERNAME=${POSTGRES_USER}
- DB_PASSWORD=${POSTGRES_PASSWORD}
- DB_DATABASE=${POSTGRES_DB}
- DB_SSL=${DB_SSL}
- DB_SYNC=${DB_SYNC}
- PORT=${PORT}
ports:
- '3023:3023'
depends_on:
- db
restart: unless-stopped
db:
image: postgres:16.8-alpine3.20
container_name: postgres-db
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- '5432:5432'
restart: unless-stopped
volumes:
pgdata: