-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
134 lines (120 loc) · 2.9 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
134 lines (120 loc) · 2.9 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
131
132
133
134
version: '3.8'
# Cbox Development Environment Template
# Includes: PHP + Nginx, MySQL, Redis, Mailpit, Node.js dev server
services:
app:
build:
context: .
dockerfile: Dockerfile.dev
container_name: cbox-dev
ports:
- "8000:80" # Web server
- "5173:5173" # Vite HMR
- "9003:9003" # Xdebug
volumes:
- ./:/var/www/html
# Cache Composer dependencies
- composer-cache:/root/.composer
# Cache npm dependencies
- node-modules:/var/www/html/node_modules
environment:
# Laravel
APP_ENV: local
APP_DEBUG: "true"
APP_KEY: base64:your-app-key-here
# Database
DB_CONNECTION: mysql
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: laravel
DB_USERNAME: laravel
DB_PASSWORD: secret
# Redis
REDIS_HOST: redis
REDIS_PASSWORD: null
REDIS_PORT: 6379
# Mail (Mailpit)
MAIL_MAILER: smtp
MAIL_HOST: mailpit
MAIL_PORT: 1025
MAIL_ENCRYPTION: null
# Xdebug
XDEBUG_MODE: debug,develop,coverage
XDEBUG_CONFIG: client_host=host.docker.internal
depends_on:
- mysql
- redis
- mailpit
networks:
- cbox-dev
# MySQL Database
mysql:
image: mysql:8.3
container_name: cbox-mysql
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: laravel
MYSQL_USER: laravel
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: root
volumes:
- mysql-data:/var/lib/mysql
networks:
- cbox-dev
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
# Redis Cache
redis:
image: redis:7-alpine
container_name: cbox-redis
ports:
- "6379:6379"
volumes:
- redis-data:/data
networks:
- cbox-dev
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
# Mailpit (Email testing)
mailpit:
image: axllent/mailpit:latest
container_name: cbox-mailpit
ports:
- "1025:1025" # SMTP
- "8025:8025" # Web UI
networks:
- cbox-dev
# Node.js Dev Server (alternative to installing in app container)
# Uncomment if you prefer separate Node.js container
# node:
# image: node:20-alpine
# container_name: cbox-node
# working_dir: /app
# volumes:
# - ./:/app
# command: npm run dev
# ports:
# - "5173:5173"
# networks:
# - cbox-dev
volumes:
mysql-data:
redis-data:
composer-cache:
node-modules:
networks:
cbox-dev:
driver: bridge
# Usage:
# docker-compose -f docker-compose.dev.yml up -d
# docker-compose -f docker-compose.dev.yml exec app bash
# docker-compose -f docker-compose.dev.yml exec app php artisan migrate
# docker-compose -f docker-compose.dev.yml exec app npm install
# docker-compose -f docker-compose.dev.yml exec app npm run dev