Skip to main content

๐Ÿ‘ฉโ€๐Ÿ’ป NestJS ็š„ Docker Compose

็’ฐๅขƒโ€‹

  • NestJs
  • Postgresql

Docker Compose ๆบ–ๅ‚™โ€‹

ๆ’ฐๅฏซ dockerfileโ€‹

ๅƒ่€ƒ ๐Ÿ‘ฉโ€๐Ÿ’ป NestJS ็š„ dockerfile ๆ’ฐๅฏซ dockerfile

ๆ’ฐๅฏซ docker-compose.ymlโ€‹

ๅœจๅฐˆๆกˆๅบ•ไธ‹ๅปบ็ซ‹ docker-compose.yml

version: '3.8'
services:
nest-app:
container_name: nest-app
build:
context: .
dockerfile: Dockerfile
ports:
- "80:3050"
depends_on:
- postgres
environment:
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: test123
POSTGRES_DB: [your_database_name]

postgres:
container_name: postgres12
image: postgres:12.3
environment:
POSTGRES_PASSWORD: test123
ports:
- "5432:5432"

ๅ•Ÿๅ‹•โ€‹

docker-compose up