-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
94 lines (89 loc) · 3.03 KB
/
Copy pathdocker-compose.yml
File metadata and controls
94 lines (89 loc) · 3.03 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
# ============================================================================
# Task Manager – Production Docker Orchestration
# ============================================================================
# Usage:
# docker compose up -d
# docker compose logs -f
# docker compose down
# ============================================================================
version: "3.9"
services:
# ==========================================================================
# PostgreSQL Database
# ==========================================================================
db:
image: postgres:16-alpine
container_name: taskmanager-db
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-taskmanager}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-secretpassword}
POSTGRES_DB: ${POSTGRES_DB:-taskmanager}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- taskmanager-network
# ==========================================================================
# Go API Server
# ==========================================================================
api:
build:
context: ./backend
dockerfile: Dockerfile
container_name: taskmanager-api
restart: unless-stopped
environment:
DATABASE_URL: ${DATABASE_URL:-postgres://taskmanager:secretpassword@db:5432/taskmanager?sslmode=disable}
JWT_SECRET: ${JWT_SECRET:-change-this-to-a-very-long-random-secret-key-in-production}
JWT_EXPIRATION: ${JWT_EXPIRATION:-24h}
API_PORT: ${API_PORT:-8080}
API_ALLOWED_ORIGINS: ${API_ALLOWED_ORIGINS:-http://localhost:3000}
ports:
- "8080:8080"
depends_on:
db:
condition: service_started
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/api/auth/me"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
networks:
- taskmanager-network
# ==========================================================================
# Next.js Frontend
# ==========================================================================
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: taskmanager-frontend
restart: unless-stopped
environment:
NODE_ENV: production
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:8080/api}
PORT: 3000
HOSTNAME: 0.0.0.0
ports:
- "3000:3000"
depends_on:
api:
condition: service_started
networks:
- taskmanager-network
# ============================================================================
# Volumes
# ============================================================================
volumes:
postgres_data:
driver: local
# ============================================================================
# Networks
# ============================================================================
networks:
taskmanager-network:
driver: bridge
name: taskmanager-network