docker-image-create.bat 999 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. @echo off
  2. ::启用变量延迟
  3. setlocal EnableDelayedExpansion
  4. echo %~n0.bat start...
  5. ::(x.1)获取basePath
  6. set curPath=%cd%
  7. cd /d "%~dp0"
  8. cd /d ../..
  9. set basePath=%cd%
  10. set publishPath=%basePath%/Publish/release/release/publish
  11. set dockerPath=%basePath%/Publish/release/release/docker-image
  12. rd /s /q "%dockerPath%"
  13. ::(x.2)copy bat
  14. xcopy "%basePath%/Publish/ReleaseFile/docker-image" "%dockerPath%" /e /i /r /y
  15. ::(x.3)查找所有需要发布的项目并发布
  16. for /f "delims=" %%f in ('findstr /M /s /i "<docker>" *.csproj') do (
  17. ::get publishName
  18. for /f "tokens=3 delims=><" %%a in ('type "%basePath%\%%f"^|findstr "<publish>.*publish"') do set publishName=%%a
  19. ::get dockerName
  20. for /f "tokens=3 delims=><" %%a in ('type "%basePath%\%%f"^|findstr "<docker>.*docker"') do set dockerName=%%a
  21. echo create !dockerName!
  22. ::copy file
  23. xcopy "%publishPath%/!publishName!" "%dockerPath%/!dockerName!/app" /e /i /r /y
  24. )
  25. echo %~n0.bat 执行成功!
  26. cd /d "%curPath%"