feat: add local docker development stack

This commit is contained in:
hajimi
2026-08-01 14:56:01 +08:00
parent deb6ce0e97
commit 8f7e831270
4 changed files with 116 additions and 2 deletions
@@ -0,0 +1,29 @@
server {
listen 80;
server_name _;
root /likeadmin_php/server/public;
index index.html index.htm index.php;
client_max_body_size 20M;
access_log /logs/sport-era-dev_access.log;
error_log /logs/sport-era-dev_error.log;
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?s=$1 last;
break;
}
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass server:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /likeadmin_php/server/public$fastcgi_script_name;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
}
+67
View File
@@ -0,0 +1,67 @@
name: sport-era-dev
services:
server:
image: registry.cn-guangzhou.aliyuncs.com/likeadmin/php:8.0.30.3-fpm
working_dir: /likeadmin_php/server
restart: unless-stopped
volumes:
- ../server:/likeadmin_php/server
networks:
- sport-era-dev
nginx:
image: registry.cn-guangzhou.aliyuncs.com/likeadmin/nginx:1.23.1
restart: unless-stopped
depends_on:
- server
ports:
- "8000:80"
volumes:
- ../server:/likeadmin_php/server:ro
- ./config/nginx/conf.d/sport-era.dev.conf:/etc/nginx/conf.d/default.conf:ro
- ./log/nginx/dev-logs:/logs
networks:
- sport-era-dev
admin:
image: node:20-alpine
working_dir: /app
restart: unless-stopped
environment:
CHOKIDAR_USEPOLLING: "true"
command: >-
sh -c "if [ ! -d node_modules/vite ]; then npm install --package-lock=false; fi;
npm run dev"
ports:
- "5176:5176"
volumes:
- ../admin:/app
- admin-node-modules:/app/node_modules
networks:
- sport-era-dev
uniapp-h5:
image: node:20-alpine
working_dir: /app
restart: unless-stopped
environment:
CHOKIDAR_USEPOLLING: "true"
command: >-
sh -c "if [ ! -x node_modules/.bin/uni ]; then npm install --legacy-peer-deps --package-lock=false; fi;
npm run dev:h5 -- --host 0.0.0.0"
ports:
- "5177:5177"
volumes:
- ../uniapp:/app
- uniapp-node-modules:/app/node_modules
networks:
- sport-era-dev
volumes:
admin-node-modules:
uniapp-node-modules:
networks:
sport-era-dev:
driver: bridge
+18
View File
@@ -13,6 +13,24 @@
## 一、已完成事项 ## 一、已完成事项
### 90. 本地 Docker 开发编排
- 状态:已完成 - 时间:2026-08-01
完成内容:
- 新增 `docker/docker-compose.dev.yml`,用于并行启动 server、admin 与 uniapp H5 开发服务。
- 该编排不声明 MySQL 或 Redis 容器;server 直接挂载并使用现有 `server/.env`,保留其中的远程数据库与 Redis 配置,不写入或覆盖连接信息。
- server 通过 Nginx 暴露在 `http://localhost:8000`,管理端与 H5 分别使用项目现有端口 `5176``5177`H5 本地开发 API 地址同步为 `http://localhost:8000`
- 已完成容器启动与 HTTP 访问验证,三个入口均可正常响应。
涉及模块:
- `docker/docker-compose.dev.yml`
- `docker/config/nginx/conf.d/sport-era.dev.conf`
- `uniapp/src/config/index.ts`
验证说明:
- 已执行 `docker compose -f docker/docker-compose.dev.yml up -d`,并核验容器状态、H5 编译日志及三个 HTTP 入口。
### 89. 移动端首页设计稿还原 ### 89. 移动端首页设计稿还原
- 状态:代码已修改,待页面验收 - 时间:2026-07-31 - 状态:代码已修改,待页面验收 - 时间:2026-07-31
+2 -2
View File
@@ -1,7 +1,7 @@
const envBaseUrl = 'https://test-server.sbnews.net/' // const envBaseUrl = 'https://test-server.sbnews.net/'
const envBaseUrl = 'http://localhost:8000'
let baseUrl = `${envBaseUrl}/` let baseUrl = `${envBaseUrl}/`
//#endif
/* /*
* `VITE_APP_BASE_URL``dev` * `VITE_APP_BASE_URL``dev`