mirror of
https://github.com/LiuYuYang01/ThriveX-Admin.git
synced 2026-09-03 07:18:05 +08:00
- 添加 Dockerfile 以使用国内镜像进行多阶段构建 - 在 Docker.md 中添加详细的 Docker 使用文档 - 优化.dockerignore以正确排除不必要的文件
1.3 KiB
1.3 KiB
Docker运行教程
环境变量说明
.env里主要有一个变量:
VITE_PROJECT_API=https://你的后端域名/api
VITE_PROJECT_API
后台管理端请求后端接口的地址。
示例:
VITE_PROJECT_API=https://api.example.com/api
注意:生产环境建议使用真实 https 域名,不要使用 localhost。
构建镜像
docker build --build-arg VITE_PROJECT_API=https://你的后端域名/api -t thrivex-admin .
说明:
VITE_PROJECT_API 是构建时变量,Vite 会在构建时写进前端静态文件。
启动容器
docker run -d --name thrivex-admin -p 9002:80 thrivex-admin
说明:
-d:后台运行--name thrivex-admin:容器名称-p 9002:80:本机9002端口映射到容器80端口thrivex-admin:镜像名称
访问页面
本地访问:
http://localhost:9002
服务器直接访问:
http://服务器IP:9002
域名访问:
https://你的后台域名
查看日志
docker logs -f thrivex-admin
重新构建并启动
docker rm -f thrivex-admin
docker build --build-arg VITE_PROJECT_API=https://你的后端域名/api -t thrivex-admin .
docker run -d --name thrivex-admin -p 9002:80 thrivex-admin