74 lines
1.5 KiB
YAML
74 lines
1.5 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# Frontend React Application
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "3000:80"
|
|
depends_on:
|
|
- backend
|
|
environment:
|
|
- REACT_APP_API_URL=http://localhost:5000/api
|
|
networks:
|
|
- project-tracker-network
|
|
|
|
# Backend API Service
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "5000:5000"
|
|
depends_on:
|
|
- postgres
|
|
environment:
|
|
- NODE_ENV=production
|
|
- PORT=5000
|
|
- DB_USER=postgres
|
|
- DB_HOST=postgres
|
|
- DB_NAME=project_tracker
|
|
- DB_PASSWORD=postgres
|
|
- DB_PORT=5432
|
|
- JWT_SECRET=your_production_jwt_secret_change_this
|
|
- CORS_ORIGIN=http://localhost:3000
|
|
networks:
|
|
- project-tracker-network
|
|
|
|
# PostgreSQL Database
|
|
postgres:
|
|
image: postgres:14
|
|
ports:
|
|
- "5432:5432"
|
|
environment:
|
|
- POSTGRES_USER=postgres
|
|
- POSTGRES_PASSWORD=postgres
|
|
- POSTGRES_DB=project_tracker
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./backend/src/config/init.sql:/docker-entrypoint-initdb.d/init.sql
|
|
networks:
|
|
- project-tracker-network
|
|
|
|
# Nginx for Production
|
|
nginx:
|
|
image: nginx:alpine
|
|
ports:
|
|
- "80:80"
|
|
volumes:
|
|
- ./nginx.conf:/etc/nginx/conf.d/default.conf
|
|
depends_on:
|
|
- frontend
|
|
- backend
|
|
networks:
|
|
- project-tracker-network
|
|
|
|
networks:
|
|
project-tracker-network:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
postgres_data:
|