-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
91 lines (86 loc) · 2.15 KB
/
docker-compose.yml
File metadata and controls
91 lines (86 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# docker-compose.yml
services:
# PostgreSQL Database
postgres:
image: postgres:15
container_name: inventory_postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: Majoba077Strong
POSTGRES_DB: inventory_db
POSTGRES_HOST_AUTH_METHOD: scram-sha-256
POSTGRES_INITDB_ARGS: "--auth-host=scram-sha-256 --auth-local=scram-sha-256"
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "PGPASSWORD=Majoba077Strong pg_isready -U postgres -d inventory_db"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
# Backend API Service
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: inventory_backend
environment:
NODE_ENV: development
PORT: 3001
DB_HOST: postgres
DB_PORT: 5432
DB_NAME: inventory_db
DB_USER: postgres
DB_PASSWORD: Majoba077Strong
JWT_SECRET: your_jwt_secret_minimum_32_characters_here
CORS_ORIGIN: http://localhost:3000
ports:
- "3001:3001"
depends_on:
postgres:
condition: service_healthy
volumes:
- ./backend:/app
- /app/node_modules
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3
restart: unless-stopped
# Frontend React Service
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: inventory_frontend
environment:
REACT_APP_API_URL: http://localhost:3001/api
REACT_APP_ENV: development
ports:
- "3000:3000"
depends_on:
- backend
volumes:
- ./frontend:/app
- /app/node_modules
stdin_open: true
tty: true
restart: unless-stopped
# Optional: pgAdmin for database management
pgadmin:
image: dpage/pgadmin4
container_name: inventory_pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: admin@admin.com
PGADMIN_DEFAULT_PASSWORD: admin123
ports:
- "8080:80"
depends_on:
- postgres
profiles:
- tools
volumes:
postgres_data: