forked from The-DevOps-Daily/devops-daily
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
118 lines (114 loc) · 3.12 KB
/
docker-compose.yaml
File metadata and controls
118 lines (114 loc) · 3.12 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# =============================================================================
# Docker Compose for DevOps Daily
# Supports both development and production modes
# =============================================================================
services:
# ===========================================================================
# Development Service
# Hot-reload enabled for local development
# ===========================================================================
dev:
build:
context: .
dockerfile: Dockerfile
args:
NODE_VERSION: 20.18.1
PNPM_VERSION: 10.11.1
BUILD_ENV: development
container_name: devops-daily-dev
image: devops-daily:dev
ports:
- "3000:3000"
volumes:
# Mount source code for hot-reload
- .:/app
# Use named volume for node_modules to avoid conflicts with host
- node_modules:/app/node_modules
# Mount pnpm store for faster installs
- pnpm_store:/app/.pnpm-store
environment:
- NODE_ENV=development
- NEXT_TELEMETRY_DISABLED=1
- WATCHPACK_POLLING=true
networks:
- devops-daily-network
# Keep container running and enable tty for better logging
tty: true
stdin_open: true
# Restart on failure
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
labels:
- "com.devops-daily.service=dev"
- "com.devops-daily.environment=development"
deploy:
resources:
limits:
cpus: '2.0'
memory: 4G
reservations:
cpus: '1.0'
memory: 2G
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# ===========================================================================
# Production Service
# Uses the main Dockerfile with nginx for serving static files
# ===========================================================================
prod:
build:
context: .
dockerfile: Dockerfile
args:
NODE_VERSION: 20.18.1
PNPM_VERSION: 10.11.1
BUILD_ENV: production
container_name: devops-daily-prod
image: devops-daily:prod
ports:
- "8080:80"
environment:
- NODE_ENV=production
networks:
- devops-daily-network
# Restart policy for production
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
labels:
- "com.devops-daily.service=prod"
- "com.devops-daily.environment=production"
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
reservations:
cpus: '0.5'
memory: 512M
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
devops-daily-network:
name: devops-daily-network
driver: bridge
volumes:
node_modules:
name: devops-daily-node-modules
pnpm_store:
name: devops-daily-pnpm-store