修改基础镜像1
Some checks failed
/ build-and-push-services (ruoyi-auth) (push) Blocked by required conditions
/ build-and-push-services (ruoyi-gateway) (push) Blocked by required conditions
/ build-and-push-services (ruoyi-modules/Property) (push) Blocked by required conditions
/ build-and-push-services (ruoyi-modules/Sis) (push) Blocked by required conditions
/ build-and-push-services (ruoyi-modules/ruoyi-gen) (push) Blocked by required conditions
/ build-and-push-services (ruoyi-modules/ruoyi-job) (push) Blocked by required conditions
/ build-and-push-services (ruoyi-modules/ruoyi-resource) (push) Blocked by required conditions
/ build-and-push-services (ruoyi-modules/ruoyi-system) (push) Blocked by required conditions
/ build-and-push-services (ruoyi-modules/ruoyi-workflow) (push) Blocked by required conditions
/ build-and-push-services (ruoyi-seata-server) (push) Blocked by required conditions
/ build-and-push-services (ruoyi-sentinel-dashboard) (push) Blocked by required conditions
/ build-and-push-services (ruoyi-snailjob-server) (push) Blocked by required conditions
/ build-and-push-services (ruoyi-visual/ruoyi-monitor) (push) Blocked by required conditions
/ build-and-push-services (ruoyi-visual/ruoyi-nacos) (push) Blocked by required conditions
/ build-parent-pom (push) Has been cancelled

This commit is contained in:
2025-08-14 17:18:34 +08:00
parent 6a7a0a344f
commit 007c40b9e6

View File

@@ -80,50 +80,50 @@ jobs:
sleep 10 sleep 10
done done
build-common-modules: # build-common-modules:
needs: build-parent-pom # needs: build-parent-pom
runs-on: ubuntu # runs-on: ubuntu
steps: # steps:
- name: 拉取代码仓库 # - name: 拉取代码仓库
uses: http://git.missmoc.top/mocheng/checkout@v4 # uses: http://git.missmoc.top/mocheng/checkout@v4
- name: 配置环境变量 # - name: 配置环境变量
run: | # run: |
export JAVA_HOME="/java17/java17" # export JAVA_HOME="/java17/java17"
export MAVEN_HOME="/maven/apache-maven-3.9.11" # export MAVEN_HOME="/maven/apache-maven-3.9.11"
echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV # echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
echo "$JAVA_HOME/bin" >> $GITHUB_PATH # echo "$JAVA_HOME/bin" >> $GITHUB_PATH
echo "MAVEN_HOME=$MAVEN_HOME" >> $GITHUB_ENV # echo "MAVEN_HOME=$MAVEN_HOME" >> $GITHUB_ENV
echo "$MAVEN_HOME/bin" >> $GITHUB_PATH # echo "$MAVEN_HOME/bin" >> $GITHUB_PATH
- name: 构建通用模块(仅本地使用,不上传) # - name: 构建通用模块(仅本地使用,不上传)
run: | # run: |
COMMON_MODULES=( # COMMON_MODULES=(
"ruoyi-common" # "ruoyi-common"
"ruoyi-api" # "ruoyi-api"
"ruoyi-common-bom" # "ruoyi-common-bom"
"ruoyi-common-alibaba-bom" # "ruoyi-common-alibaba-bom"
"ruoyi-api-bom" # "ruoyi-api-bom"
) # )
for module in "${COMMON_MODULES[@]}"; do # for module in "${COMMON_MODULES[@]}"; do
MODULE_POM_ABSOLUTE_PATH="${GITHUB_WORKSPACE}/${module}/pom.xml" # MODULE_POM_ABSOLUTE_PATH="${GITHUB_WORKSPACE}/${module}/pom.xml"
if [ ! -f "$MODULE_POM_ABSOLUTE_PATH" ]; then # if [ ! -f "$MODULE_POM_ABSOLUTE_PATH" ]; then
echo "警告:模块 $module 不存在,跳过" # echo "警告:模块 $module 不存在,跳过"
continue # continue
fi # fi
retries=3 # retries=3
count=0 # count=0
until "$MAVEN_HOME/bin/mvn" clean compile install -U -DskipTests -f "$MODULE_POM_ABSOLUTE_PATH"; do # until "$MAVEN_HOME/bin/mvn" clean compile install -U -DskipTests -f "$MODULE_POM_ABSOLUTE_PATH"; do
count=$((count + 1)) # count=$((count + 1))
if [ $count -ge $retries ]; then # if [ $count -ge $retries ]; then
echo "错误:模块 $module 构建失败" # echo "错误:模块 $module 构建失败"
exit 1 # exit 1
fi # fi
sleep 10 # sleep 10
done # done
done # done
build-and-push-services: build-and-push-services:
needs: build-common-modules needs: build-common-modules
@@ -169,21 +169,8 @@ jobs:
"$MAVEN_HOME/bin/mvn" clean package -U -DskipTests -f "$SERVICE_POM_ABSOLUTE_PATH" "$MAVEN_HOME/bin/mvn" clean package -U -DskipTests -f "$SERVICE_POM_ABSOLUTE_PATH"
- name: 检查JAR文件是否存在 - name: 配置Docker Buildx
run: |
SERVICE_NAME="${{ matrix.service }}"
JAR_PATH="${GITHUB_WORKSPACE}/${SERVICE_NAME}/target/$(basename ${SERVICE_NAME}).jar"
if [ ! -f "$JAR_PATH" ]; then
echo "错误JAR文件不存在 - $JAR_PATH"
echo "目标目录内容:"
ls -l "${GITHUB_WORKSPACE}/${SERVICE_NAME}/target"
exit 1
fi
- name: 配置Docker Buildx使用原生Docker驱动
uses: http://git.missmoc.top/mocheng/setup-buildx-action@v3 uses: http://git.missmoc.top/mocheng/setup-buildx-action@v3
with:
driver: docker # 避免容器化驱动的网络隔离问题
- name: 登录到容器仓库 - name: 登录到容器仓库
uses: http://git.missmoc.top/mocheng/login-action@v3 uses: http://git.missmoc.top/mocheng/login-action@v3
@@ -207,19 +194,27 @@ jobs:
- name: 构建并推送Docker镜像仅推送镜像不上传JAR - name: 构建并推送Docker镜像仅推送镜像不上传JAR
uses: http://git.missmoc.top/mocheng/build-push-action@v5 uses: http://git.missmoc.top/mocheng/build-push-action@v5
with: with:
# 使用服务模块目录作为构建上下文确保能找到target/JAR context: "${{ github.workspace }}"
context: "${{ github.workspace }}/${{ matrix.service }}" file: "${{ github.workspace }}/${{ matrix.service }}/Dockerfile"
file: "${{ steps.dockerfile-path.outputs.dockerfile_path }}" tags: "172.100.10.45:3000/by2025/smartparks/${{ matrix.service }}:latest"
# 处理镜像标签中的斜杠(避免格式错误)
tags: "172.100.10.45:3000/by2025/smartparks/$(echo ${{ matrix.service }} | tr '/' '-'):latest"
push: true push: true
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
# 允许HTTP访问私有仓库
# 关键配置允许该仓库使用HTTP
daemon-config: | daemon-config: |
{ {
"insecure-registries": ["172.100.10.45:3000"] "insecure-registries": ["172.100.10.45:3000"]
} }
# 禁用容器化网络,使用主机网络
# 确保buildx使用正确的网络配置
driver-opts: | driver-opts: |
network=host network=host
# context: "${{ github.workspace }}"
# file: ${{ github.workspace }}/${{ matrix.service }}/Dockerfile
# tags: 172.100.10.45:3000/by2025/smartparks/${{ matrix.service }}:latest
# # tags: ${{ secrets.REGISTRY_URL }}/by2025/$(echo ${{ matrix.service }} | tr 'A-Z' 'a-z'):${{ github.sha }}
# # tags: ${{ secrets.REGISTRY_URL }}/by2025/${{ matrix.service }}:2.0.4
# push: true
# cache-from: type=gha
# cache-to: type=gha,mode=max