-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
130 lines (121 loc) · 3.74 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
130 lines (121 loc) · 3.74 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
119
120
121
122
123
124
125
126
127
128
129
130
services:
# PostgreSQL Database
database:
image: postgres:15-alpine
container_name: jira-clone-db-dev
restart: unless-stopped
environment:
POSTGRES_DB: jira_clone
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
volumes:
- postgres_data_dev:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d jira_clone"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- jira-network-dev
# Spring Boot Backend - Development Mode
backend:
image: openjdk:17-jdk-slim
container_name: jira-clone-backend-dev
restart: unless-stopped
working_dir: /app
command: >
bash -c "
# Install Maven and PostgreSQL client
apt-get update && apt-get install -y maven curl postgresql-client &&
# Wait for database
until pg_isready -h database -p 5432 -U postgres; do
echo 'Waiting for database...'
sleep 2
done &&
# Run Spring Boot in development mode with hot reload
mvn spring-boot:run -Dspring-boot.run.jvmArguments='-Dspring.profiles.active=dev'
"
environment:
# Database configuration
SPRING_DATASOURCE_URL: jdbc:postgresql://database:5432/jira_clone
SPRING_DATASOURCE_USERNAME: postgres
SPRING_DATASOURCE_PASSWORD: postgres
SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver
# JPA configuration
SPRING_JPA_HIBERNATE_DDL_AUTO: update
SPRING_JPA_SHOW_SQL: "true"
SPRING_JPA_PROPERTIES_HIBERNATE_DIALECT: org.hibernate.dialect.PostgreSQLDialect
SPRING_JPA_PROPERTIES_HIBERNATE_FORMAT_SQL: "true"
# JWT configuration
APP_JWT_SECRET: mySecretKey123456789012345678901234567890
APP_JWT_EXPIRATION: 86400000
# CORS configuration
SPRING_WEB_CORS_ALLOWED_ORIGINS: http://localhost:3000,http://frontend:3000
SPRING_WEB_CORS_ALLOWED_METHODS: GET,POST,PUT,DELETE,OPTIONS
SPRING_WEB_CORS_ALLOWED_HEADERS: "*"
SPRING_WEB_CORS_ALLOW_CREDENTIALS: "true"
# Server configuration
SERVER_PORT: 8080
# Development mode
SPRING_DEVTOOLS_RESTART_ENABLED: "true"
SPRING_DEVTOOLS_LIVERELOAD_ENABLED: "true"
ports:
- "8080:8080"
volumes:
# Mount the entire backend source code
- ./backend:/app
# Cache Maven dependencies to speed up restarts
- maven_cache_dev:/root/.m2
depends_on:
database:
condition: service_healthy
networks:
- jira-network-dev
# Next.js Frontend - Development Mode
frontend:
image: node:18-alpine
container_name: jira-clone-frontend-dev
restart: unless-stopped
working_dir: /app
command: >
sh -c "
# Install dependencies with legacy peer deps to handle React 19
npm install --legacy-peer-deps &&
# Start Next.js in development mode with hot reload
npm run dev
"
environment:
# Next.js configuration
NODE_ENV: development
NEXT_PUBLIC_API_URL: http://localhost:8080/api
# Enable hot reload
WATCHPACK_POLLING: "true"
CHOKIDAR_USEPOLLING: "true"
ports:
- "3000:3000"
volumes:
# Mount the entire frontend source code
- ./frontend:/app
# Exclude node_modules from the mount to allow npm install
- /app/node_modules
depends_on:
- backend
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:3000 || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
networks:
- jira-network-dev
volumes:
postgres_data_dev:
driver: local
maven_cache_dev:
driver: local
networks:
jira-network-dev:
driver: bridge