Explorar el Código

fix docker-compose

bwcx_jzy hace 2 años
padre
commit
797550f0b4
Se han modificado 4 ficheros con 13 adiciones y 12 borrados
  1. 2 2
      .dockerignore
  2. 1 0
      README.md
  3. 1 1
      modules/server/Dockerfile
  4. 9 9
      script/replaceVersion.sh

+ 2 - 2
.dockerignore

@@ -156,8 +156,8 @@ web_modules/
 .yarn-integrity
 
 # dotenv environment variables file
-.env
-.env.test
+#.env
+#.env.test
 
 # parcel-bundler cache (https://parceljs.org/)
 .cache

+ 1 - 0
README.md

@@ -285,6 +285,7 @@ git clone https://gitee.com/dromara/Jpom.git
 cd Jpom
 docker-compose -f docker-compose.yml up
 # docker-compose -f docker-compose.yml up --build
+# docker-compose -f docker-compose.yml build --no-cache
 # docker-compose -f docker-compose-local.yml up
 # docker-compose -f docker-compose-local.yml build --build-arg TEMP_VERSION=.0
 ```

+ 1 - 1
modules/server/Dockerfile

@@ -32,7 +32,7 @@ VOLUME ["/root/.m2","/target/dependency/web-vue/node_modules"]
 ARG TEMP_VERSION=""
 ARG JPOM_VERSION
 ENV USE_JPOM_VERSION=${JPOM_VERSION}${TEMP_VERSION}
-RUN --mount=type=cache,target=/root/.m2 sh ./script/replaceVersion.sh ${USE_JPOM_VERSION}
+RUN --mount=type=cache,target=/root/.m2  bash ./script/replaceVersion.sh "${USE_JPOM_VERSION}" "release"
 
 ENV NODE_VERSION 16.13.1
 

+ 9 - 9
script/replaceVersion.sh

@@ -42,8 +42,8 @@ Linux)
 esac
 base=${bin_abs_path}/../
 
-echo "当前路径:${current_path} 脚本路径:${bin_abs_path}"
 tag="$2"
+echo "当前路径:${current_path} 脚本路径:${bin_abs_path} $tag"
 
 if [ -n "$1" ]; then
 	new_version="$1"
@@ -51,18 +51,18 @@ if [ -n "$1" ]; then
 	echo "$old_version 替换为新版本 $new_version"
 else
 	# 参数错误,退出
-	echo "ERROR: 请指定新版本!"
-	exit
+	echo "ERROR: 请指定新版本!" 2>&2
+	exit 1
 fi
 
 if [ ! -n "$old_version" ]; then
-	echo "ERROR: 旧版本不存在,请确认 /script/tag.$tag.txt 中信息正确"
-	exit
+	echo "ERROR: 旧版本不存在,请确认 /script/tag.$tag.txt 中信息正确" 2>&2
+	exit 1
 fi
 
 echo "替换配置文件版本号 $new_version"
 
-if [ "$tag" == "release" ]; then
+if [[ "$tag" == "release" ]]; then
 	# 替换 Dockerfile 中的版本
 	sed -i.bak "s/${old_version}/${new_version}/g" "$base/modules/server/Dockerfile"
 	sed -i.bak "s/${old_version}/${new_version}/g" "$base/modules/agent/Dockerfile"
@@ -77,12 +77,12 @@ if [ "$tag" == "release" ]; then
 elif [ "$tag" == "beta" ]; then
 	sed -i.bak "s/${old_version}/${new_version}/g" "$base/modules/server/DockerfileBeta"
 else
-	echo "不支持的模式 $tag"
-	exit
+	echo "不支持的模式 $tag" 2>&2
+	exit 2
 fi
 
 # 替换所有模块pom.xml中的版本
-cd "${base}" && mvn versions:set -DnewVersion=$new_version
+cd "${base}" && mvn -s "$base/script/settings.xml" versions:set -DnewVersion=$new_version
 
 # 替换 docker 中的版本
 sed -i.bak "s/${old_version}/${new_version}/g" "$base/env-$tag.env"