Browse Source

add powershell build scripts

pull/67/head
cKey 5 years ago
parent
commit
0ce4d31f05
  1. 6
      README.en.md
  2. 6
      README.md
  3. 4
      aspnet-core/services/start-apigateway-admin.bat
  4. 3
      aspnet-core/services/start-apigateway-host.bat
  5. 3
      aspnet-core/services/start-backend-admin.bat
  6. 5
      aspnet-core/services/start-identity-server.bat
  7. 3
      aspnet-core/services/start-messages.bat
  8. 3
      aspnet-core/services/start-platform.bat
  9. 17
      build/build-aspnetcore-common.ps1
  10. 11
      build/build-aspnetcore-release.ps1
  11. 20
      build/build-vue-element-admin.ps1

6
README.en.md

@ -293,11 +293,11 @@ yarn run build:prod
### About Docker container
**Step 1**: build the background service, recommend running the batch file directly, parameters of the publish, the content, can see the batch **pay attention to the configuration file, after the release of service requires appsettings.Production.json**
**Step 1**: Building background services, powershell script: **./build/build-aspnetcore-release.ps1**, **Warning: after the release of service need configuration file: appsettings.Production.json**
**Step 2**: Build the front-end, yarn/npm build:PROD
**Step 2**: Build the front-end, **./build/build-vue-element-admin.ps1**
**Step 3**: Change nginx proxy server address, ./vueJs/docker/nginx/default.conf
**Step 3**: Build after the release of the address of the default in **./aspnet-core/services/Publish**, change nginx proxy server address: **./client/docker/nginx/default.conf**
**Step 4**: Run command **sudo docker-compose down && sudo docker-compose -f docker-compose.yml -f docker-compose.override.yml up --build -d**

6
README.md

@ -296,11 +296,11 @@ yarn build:prod
### 关于docker容器部署
**第一步**: 构建后台服务,推荐直接运行批处理文件,参数为 --publish,具体可参见批处理内容,**注意配置文件,发布后的服务需要 appsettings.Production.json 文件**
**第一步**: 构建后台服务, powershell脚本:**./build/build-aspnetcore-release.ps1**, **注意:发布后的服务需要 appsettings.Production.json 文件**
**第二步**: 构建前端, yarn/npm build:prod
**第二步**: 构建前端, **./build/build-vue-element-admin.ps1**
**第三步**: 变更nginx代理服务器地址, ./vueJs/docker/nginx/default.conf
**第三步**: 构建后的发布地址默认在**cd ./aspnet-core/services/Publish** ,变更nginx代理服务器地址: **./client/docker/nginx/default.conf**
**第四步**: 运行此命令 **sudo docker-compose down && sudo docker-compose -f docker-compose.yml -f docker-compose.override.yml up --build -d**

4
aspnet-core/services/start-apigateway-admin.bat

@ -6,6 +6,7 @@ echo. 启动网关管理服务
cd .\apigateway\LINGYUN.ApiGateway.HttpApi.Host
echo %1
if '%1' equ '--publish' goto publish
if '%1' equ '--run' goto run
if '%1' equ '--restore' goto restore
@ -15,15 +16,12 @@ if '%1' equ '' goto run
:publish
dotnet publish -c Release -o ..\..\Publish\apigateway-admin --no-cache --no-restore
copy Dockerfile ..\..\Publish\apigateway-admin \Dockerfile
pause
exit
:run
dotnet run
pause
exit
:restore
dotnet restore
pause
exit

3
aspnet-core/services/start-apigateway-host.bat

@ -14,15 +14,12 @@ if '%1' equ '' goto run
:publish
dotnet publish -c Release -o ..\..\Publish\apigateway-host --no-cache --no-restore
copy Dockerfile ..\..\Publish\apigateway-host\Dockerfile
pause
exit
:run
dotnet run
pause
exit
:restore
dotnet restore
pause
exit

3
aspnet-core/services/start-backend-admin.bat

@ -15,15 +15,12 @@ exit
:publish
dotnet publish -c Release -o ..\..\Publish\admin --no-cache --no-restore
copy Dockerfile ..\..\Publish\admin\Dockerfile
pause
exit
:run
dotnet run
pause
exit
:restore
dotnet restore
pause
exit

5
aspnet-core/services/start-identity-server.bat

@ -14,16 +14,13 @@ exit
:publish
dotnet publish -c Release -o ..\..\Publish\identityserver --no-cache --no-restore
copy Dockerfile ..\..\Publish\account\Dockerfile
pause
copy Dockerfile ..\..\Publish\identityserver\Dockerfile
exit
:run
dotnet run
pause
exit
:restore
dotnet restore
pause
exit

3
aspnet-core/services/start-messages.bat

@ -15,15 +15,12 @@ exit
:publish
dotnet publish -c Release -o ..\..\Publish\messages --no-cache --no-restore
copy Dockerfile ..\..\Publish\messages\Dockerfile
pause
exit
:run
dotnet run
pause
exit
:restore
dotnet restore
pause
exit

3
aspnet-core/services/start-platform.bat

@ -15,15 +15,12 @@ exit
:publish
dotnet publish -c Release -o ..\..\Publish\platform --no-cache --no-restore
copy Dockerfile ..\..\Publish\platform\Dockerfile
pause
exit
:run
dotnet run
pause
exit
:restore
dotnet restore
pause
exit

17
build/build-aspnetcore-common.ps1

@ -0,0 +1,17 @@
# COMMON PATHS
$rootFolder = (Get-Item -Path "./" -Verbose).FullName
# List of solutions used only in development mode
$batchCommandPaths = @(
"../aspnet-core/services/start-identity-server.bat",
"../aspnet-core/services/start-backend-admin.bat",
"../aspnet-core/services/start-apigateway-host.bat",
"../aspnet-core/services/start-apigateway-admin.bat",
"../aspnet-core/services/start-messages.bat",
"../aspnet-core/services/start-platform.bat"
)
Write-host ""
Write-host ":::::::::::::: !!! You are in development mode !!! ::::::::::::::" -ForegroundColor red -BackgroundColor yellow
Write-host ""

11
build/build-aspnetcore-release.ps1

@ -0,0 +1,11 @@
. "./build-aspnetcore-common.ps1"
# Build all solutions
foreach ($batchCommandPath in $batchCommandPaths) {
$file = [io.fileinfo]$batchCommandPath;
Write-Host $file.DirectoryName
Set-Location $file.DirectoryName
CMD /c $file.Name --publish -Wait
}
Set-Location $rootFolder

20
build/build-vue-element-admin.ps1

@ -0,0 +1,20 @@
$rootFolder = (Get-Item -Path "./" -Verbose).FullName
$vuePath = Join-Path $rootFolder "../vueJs"
$publishPath = Join-Path $rootFolder "../aspnet-core/services/Publish/client"
$distPath = Join-Path $rootFolder "../aspnet-core/services/Publish/client/dist"
$dockerPath = Join-Path $rootFolder "../aspnet-core/services/Publish/client/docker"
Set-Location $vuePath
Remove-Item (Join-Path $vuePath "dist") -Recurse
Remove-Item $publishPath -Recurse
CMD /c npm install
CMD /c npm run build:prod
Copy-Item -Path (Join-Path $vuePath "dist") -Destination $distPath -Recurse
Copy-Item -Path (Join-Path $vuePath "docker") -Destination $dockerPath -Recurse
Copy-Item (Join-Path $vuePath "Dockerfile") -Destination $publishPath
Set-Location $rootFolder
Loading…
Cancel
Save