This project demonstrates a Docker-based system composed of three services: a Node.js web server, a PostgreSQL database, and an Nginx reverse proxy. The goal is to simulate a production-ready architecture using Docker Compose and custom configurations.
The Docker image used in this exercise is available for download at the link above.
[User Browser]
⇩
localhost:80 (Nginx)
⇩
localhost:8080 (Node.js server)
⇩
PostgreSQL (Database)
Nginxlistens on port80and forwards HTTP requests to the Node.js server on port8080.- The Node.js server communicates with the PostgreSQL database for application logic and data storage.
Create_Image/ # Docker를 활용한 이미지 생성 프로젝트 루트
├── nginx/ # Nginx 관련 설정 폴더
│ ├── Dockerfile # Nginx용 Docker 이미지 빌드 설정 파일
│ └── myconfig1.conf # 사용자 정의 Nginx 설정 파일
│
├── node_modules/ # Node.js 의존성 폴더 (자동 생성)
│
├── vol/ # 볼륨 마운트를 위한 폴더
│
├── .dockerignore # Docker ignore
├── .env
├── .gitignore
│
├── docker-compose.yml # 여러 컨테이너를 정의하는 Compose 설정 파일
├── Dockerfile # Node.js 앱을 위한 Docker 이미지 정의
│
├── package-lock.json # npm 의존성 고정 파일
├── package.json # 프로젝트 메타정보 및 의존성 정의
├── sever.js
│
└── README.md
docker compose up --builddocker compose up -d nginx# Uncomment in docker-compose.yml
deploy:
mode: replicated
replicas: 3Run with:
docker compose --compatibility up