来源仓库:jxc/ai-fresh-delivery 来源提交:f0b1a180e2deb7e4673b9d1c8542619f7bc0f73d 快照树: 09f679334ff38f0ff25e907961c94a8223bcaedd(与来源 HEAD 工作树逐字节一致,3801 个文件) 按约定本仓库不带任何历史提交:来源仓库的历史中含真实凭据 (生产 SSH 私钥 deploy/id_rsa_tencent、server/.env、.env.tencent/.env.production/.env.gitea、 deploy/小程序AppSecret.txt,其中 MP_APPSECRET / S3 AccessKey 经哈希比对与线上同值), 整包推送会把这些凭据永久带入本仓库,故只取「当前版本」的单提交快照。 供应商系统后续开发自本提交开始。
49 lines
2.4 KiB
PowerShell
49 lines
2.4 KiB
PowerShell
# ═══════════════════════════════════════════════════════════
|
|
# canteen-delivery2 Docker 生产部署脚本
|
|
# 前置条件: Docker + Docker Compose 已安装
|
|
# 用法: .\deploy-docker.ps1
|
|
# ═══════════════════════════════════════════════════════════
|
|
|
|
$ProjectRoot = "C:\Users\ADMIN\Desktop\project\canteen-delivery2"
|
|
Set-Location $ProjectRoot
|
|
|
|
Write-Host ""
|
|
Write-Host "══════════════════════════════════════════" -ForegroundColor Cyan
|
|
Write-Host " Docker 生产部署" -ForegroundColor Cyan
|
|
Write-Host "══════════════════════════════════════════" -ForegroundColor Cyan
|
|
|
|
# 检查 Docker
|
|
$dockerVersion = docker --version 2>$null
|
|
if (-not $dockerVersion) {
|
|
Write-Host "Docker 未安装。请使用 .\deploy.ps1 进行原生部署" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
Write-Host "Docker: $dockerVersion" -ForegroundColor Green
|
|
|
|
# 检查 .env.production
|
|
if (-not (Test-Path ".env.production")) {
|
|
Write-Host "请先配置 .env.production(可复制 .env.production.example 修改)" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "构建镜像并启动容器..." -ForegroundColor Yellow
|
|
Write-Host ""
|
|
|
|
# 构建并启动
|
|
docker compose -f docker-compose.prod.yml --env-file .env.production up -d --build
|
|
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "Docker 部署失败" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "══════════════════════════════════════════" -ForegroundColor Green
|
|
Write-Host " Docker 部署完成!" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host " 查看日志: docker compose -f docker-compose.prod.yml --env-file .env.production logs -f app" -ForegroundColor White
|
|
Write-Host " 停止服务: docker compose -f docker-compose.prod.yml --env-file .env.production down" -ForegroundColor White
|
|
Write-Host " 访问地址: http://localhost:8080" -ForegroundColor Cyan
|
|
Write-Host "══════════════════════════════════════════" -ForegroundColor Green
|