build.bat 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. :: Licensed to the Apache Software Foundation (ASF) under one or more
  2. :: contributor license agreements. See the NOTICE file distributed with
  3. :: this work for additional information regarding copyright ownership.
  4. :: The ASF licenses this file to You under the Apache License, Version 2.0
  5. :: (the "License"); you may not use this file except in compliance with
  6. :: the License. You may obtain a copy of the License at
  7. ::
  8. :: http://www.apache.org/licenses/LICENSE-2.0
  9. ::
  10. :: Unless required by applicable law or agreed to in writing, software
  11. :: distributed under the License is distributed on an "AS IS" BASIS,
  12. :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. :: See the License for the specific language governing permissions and
  14. :: limitations under the License.
  15. ::
  16. @echo off
  17. echo "------ dolphinscheduler start - build -------"
  18. set
  19. setlocal enableextensions enabledelayedexpansion
  20. if not defined VERSION (
  21. echo "set environment variable [VERSION]"
  22. set first=1
  23. for /f "tokens=3 delims=<>" %%a in ('findstr "<version>[0-9].*</version>" %cd%\pom.xml') do (
  24. if !first! EQU 1 (set VERSION=%%a)
  25. set first=0
  26. )
  27. )
  28. if not defined DOCKER_REPO (
  29. echo "set environment variable [DOCKER_REPO]"
  30. set DOCKER_REPO=dolphinscheduler
  31. )
  32. echo "Version: %VERSION%"
  33. echo "Repo: %DOCKER_REPO%"
  34. echo "Current Directory is %cd%"
  35. :: maven package(Project Directory)
  36. echo "mvn clean package -Prelease -DskipTests=true -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120"
  37. call mvn clean package -Prelease -DskipTests=true -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
  38. if "%errorlevel%"=="1" goto :mvnFailed
  39. :: move dolphinscheduler-bin.tar.gz file to docker/build directory
  40. echo "move %cd%\dolphinscheduler-dist\target\apache-dolphinscheduler-%VERSION%-bin.tar.gz %cd%\docker\build\"
  41. move %cd%\dolphinscheduler-dist\target\apache-dolphinscheduler-%VERSION%-bin.tar.gz %cd%\docker\build\
  42. :: docker build
  43. echo "docker build --build-arg VERSION=%VERSION% -t %DOCKER_REPO%:%VERSION% %cd%\docker\build\"
  44. docker build --build-arg VERSION=%VERSION% -t %DOCKER_REPO%:%VERSION% %cd%\docker\build\
  45. if "%errorlevel%"=="1" goto :dockerBuildFailed
  46. echo "------ dolphinscheduler end - build -------"
  47. :mvnFailed
  48. echo "MAVEN PACKAGE FAILED!"
  49. :dockerBuildFailed
  50. echo "DOCKER BUILD FAILED!"