Browse Source

Merge pull request #4977 from chengshiwen/fix-docker-image-build-on-windows

[Fix-3124][Docker] Fix that can not build a docker image on Windows
pull/3/MERGE
xingchun-chen 4 years ago committed by GitHub
parent
commit
fd581af726
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      docker/build/hooks/build
  2. 11
      docker/build/hooks/build.bat
  3. 2
      docker/build/hooks/push

5
docker/build/hooks/build

@ -24,8 +24,7 @@ printenv
if [ -z "${VERSION}" ] if [ -z "${VERSION}" ]
then then
echo "set default environment variable [VERSION]" echo "set default environment variable [VERSION]"
VERSION=$(grep '<revision>' -m 1 "$(pwd)"/pom.xml | awk '{print $1}' | sed 's/<revision>//' | sed 's/<\/revision>//') export VERSION=$(cat $(pwd)/pom.xml | grep '<revision>' -m 1 | awk '{print $1}' | sed 's/<revision>//' | sed 's/<\/revision>//')
export VERSION
fi fi
if [ "${DOCKER_REPO}x" = "x" ] if [ "${DOCKER_REPO}x" = "x" ]
@ -45,7 +44,7 @@ mvn -B clean compile package -Prelease -Dmaven.test.skip=true
# mv dolphinscheduler-bin.tar.gz file to docker/build directory # mv dolphinscheduler-bin.tar.gz file to docker/build directory
echo -e "mv $(pwd)/dolphinscheduler-dist/target/apache-dolphinscheduler-incubating-${VERSION}-dolphinscheduler-bin.tar.gz $(pwd)/docker/build/\n" echo -e "mv $(pwd)/dolphinscheduler-dist/target/apache-dolphinscheduler-incubating-${VERSION}-dolphinscheduler-bin.tar.gz $(pwd)/docker/build/\n"
mv "$(pwd)"/dolphinscheduler-dist/target/apache-dolphinscheduler-incubating-"${VERSION}"-dolphinscheduler-bin.tar.gz $(pwd)/docker/build/ mv $(pwd)/dolphinscheduler-dist/target/apache-dolphinscheduler-incubating-${VERSION}-dolphinscheduler-bin.tar.gz $(pwd)/docker/build/
# docker build # docker build
BUILD_COMMAND="docker build --build-arg VERSION=${VERSION} -t $DOCKER_REPO:${VERSION} $(pwd)/docker/build/" BUILD_COMMAND="docker build --build-arg VERSION=${VERSION} -t $DOCKER_REPO:${VERSION} $(pwd)/docker/build/"

11
docker/build/hooks/build.bat

@ -17,15 +17,20 @@
echo "------ dolphinscheduler start - build -------" echo "------ dolphinscheduler start - build -------"
set set
setlocal enableextensions enabledelayedexpansion
if not defined VERSION ( if not defined VERSION (
echo "set environment variable [VERSION]" echo "set environment variable [VERSION]"
for /f %%l in (%cd%\sql\soft_version) do (set VERSION=%%l) set first=1
for /f "tokens=3 delims=<>" %%a in ('findstr "<revision>[0-9].*</revision>" %cd%\pom.xml') do (
if !first! EQU 1 (set VERSION=%%a)
set first=0
)
) )
if not defined DOCKER_REPO ( if not defined DOCKER_REPO (
echo "set environment variable [DOCKER_REPO]" echo "set environment variable [DOCKER_REPO]"
set DOCKER_REPO='dolphinscheduler' set DOCKER_REPO=dolphinscheduler
) )
echo "Version: %VERSION%" echo "Version: %VERSION%"
@ -40,7 +45,7 @@ if "%errorlevel%"=="1" goto :mvnFailed
:: move dolphinscheduler-bin.tar.gz file to docker/build directory :: move dolphinscheduler-bin.tar.gz file to docker/build directory
echo "move %cd%\dolphinscheduler-dist\target\apache-dolphinscheduler-incubating-%VERSION%-SNAPSHOT-dolphinscheduler-bin.tar.gz %cd%\docker\build\" echo "move %cd%\dolphinscheduler-dist\target\apache-dolphinscheduler-incubating-%VERSION%-SNAPSHOT-dolphinscheduler-bin.tar.gz %cd%\docker\build\"
move %cd%\dolphinscheduler-dist\target\apache-dolphinscheduler-incubating-%VERSION%-SNAPSHOT-dolphinscheduler-bin.tar.gz %cd%\docker\build\ move %cd%\dolphinscheduler-dist\target\apache-dolphinscheduler-incubating-%VERSION%-dolphinscheduler-bin.tar.gz %cd%\docker\build\
:: docker build :: docker build
echo "docker build --build-arg VERSION=%VERSION% -t %DOCKER_REPO%:%VERSION% %cd%\docker\build\" echo "docker build --build-arg VERSION=%VERSION% -t %DOCKER_REPO%:%VERSION% %cd%\docker\build\"

2
docker/build/hooks/push

@ -19,6 +19,6 @@
echo "------ push start -------" echo "------ push start -------"
printenv printenv
docker push "$DOCKER_REPO:${VERSION}" docker push $DOCKER_REPO:${VERSION}
echo "------ push end -------" echo "------ push end -------"

Loading…
Cancel
Save