Files
cursor/rules/dev-environment.mdc
2026-05-21 18:16:26 +08:00

43 lines
1.2 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
description: Slot 本地 Docker 开发环境PHP / MySQL / Redis
alwaysApply: true
---
# Local Dev (Docker)
PHP、MySQL、Redis 均在 Docker 中运行;**不要在 macOS 宿主机**直接执行 `php` / `composer`(除非已确认本机版本与项目一致)。
## Compose 与挂载
- Compose`/Users/ray/Documents/project/docker/docker-compose.yml`
- 宿主机项目根:`/Users/ray/Documents/project` → 容器内 `/app`
- Slot 服务路径:`/app/www/slot/<repo>`(如 `slot_wallet`、`slot_user`、`backend/slot_admin`
## 容器与端口
| 服务 | 容器名 | 宿主机端口 |
| --- | --- | --- |
| PHP 8.2(默认) | `php82` | — |
| MySQL 8 | `goMysql` | `3309` → 容器 `3306` |
| Redis | `redis` | `6379` |
| Go Redis | `goredis` | `6378` → 容器 `6379` |
凭据以 `docker-compose.yml` 为准。
## 执行命令
默认在 `php82` 内、对应服务目录执行Webman 项目无 `artisan`
```bash
docker exec -w /app/www/slot/slot_wallet php82 php webman <command>
docker exec -w /app/www/slot/slot_wallet php82 composer install
```
MySQL CLI容器内
```bash
docker exec -it goMysql mysql -uroot -p
```
从宿主机连接:`127.0.0.1:3309`MySQL、`127.0.0.1:6379`Redis