diff --git a/.github/workflows/build_deb.yml b/.github/workflows/build_deb.yml index d3af652958..f9fc36d4f2 100644 --- a/.github/workflows/build_deb.yml +++ b/.github/workflows/build_deb.yml @@ -19,7 +19,8 @@ jobs: calculatedSha=$(git rev-parse --short ${{ github.sha }}) echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV sed -i "s//${{ env.PBH_VERSION }}/g" pkg/deb/DEBIAN/control - cp target/PeerBanHelper.jar pkg/deb/usr/lib/peerbanhelper + mkdir -p pkg/deb/usr/lib/peerbanhelper + cp target/PeerBanHelper.jar pkg/deb/usr/lib/peerbanhelper/ cd pkg && dpkg -b deb PeerBanHelper_linux_${{ env.PBH_VERSION }}.deb # 上面那个文件名需要符合收集条件 env: @@ -30,4 +31,3 @@ jobs: name: deb-dist path: | pkg/*.deb - diff --git a/.github/workflows/build_installers.yml b/.github/workflows/build_installers.yml index 72aef4ccdc..dda81bb4a2 100644 --- a/.github/workflows/build_installers.yml +++ b/.github/workflows/build_installers.yml @@ -23,8 +23,8 @@ jobs: license: ${{ secrets.INSTALL4J_LICENSE }} - name: Make installers run: | - ls /opt/install4j/ - /opt/install4j/bin/install4jc -L ${{ secrets.INSTALL4J_LICENSE }} -r ${{ steps.java_info.outputs.project_version }} -d target/media -D jarPath=target/PeerBanHelper.jar install4j/project.install4j + /opt/install4j/bin/install4jc -L ${{ secrets.INSTALL4J_LICENSE }} -r ${{ steps.java_info.outputs.project_version }} -g -d target/media -D jarPath=$(pwd)/target/PeerBanHelper.jar install4j/project.install4j + # jarPath=$(pwd) 是必须的,install4jc 不知道什么毛病,不支持相对路径,这太诡异了 - name: Upload build artifacts uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/build_maven.yml b/.github/workflows/build_maven.yml index 9e1383a7c5..7972031451 100644 --- a/.github/workflows/build_maven.yml +++ b/.github/workflows/build_maven.yml @@ -33,5 +33,4 @@ jobs: name: maven-dist path: | target/*.jar - target/media/*.exe id: project \ No newline at end of file diff --git a/.github/workflows/jvm-ci.yml b/.github/workflows/jvm-ci.yml index 519cb1e2ce..70d4591417 100644 --- a/.github/workflows/jvm-ci.yml +++ b/.github/workflows/jvm-ci.yml @@ -61,7 +61,7 @@ jobs: uses: docker/build-push-action@v6.7.0 with: context: . - file: ./Dockerfile-CI + file: ./Dockerfile push: true platforms: | linux/amd64 diff --git a/.github/workflows/jvm-release.yml b/.github/workflows/jvm-release.yml index 79017f4b7c..ef12c9808c 100644 --- a/.github/workflows/jvm-release.yml +++ b/.github/workflows/jvm-release.yml @@ -87,7 +87,7 @@ jobs: - uses: actions/download-artifact@v4 with: name: maven-dist - path: target/ + path: target - name: Set Up QEMU uses: docker/setup-qemu-action@v3 - name: Set Up Buildx @@ -151,7 +151,7 @@ jobs: uses: docker/build-push-action@v6.7.0 with: context: . - file: ./Dockerfile + file: ./Dockerfile-Release push: true platforms: | linux/amd64 diff --git a/Dockerfile b/Dockerfile index 1f1ccd141d..c116d8313b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,22 @@ -# 构建前端 -FROM --platform=$BUILDPLATFORM docker.io/node:alpine AS frontend-build -COPY ./webui /build/webui -WORKDIR /build/webui -RUN corepack enable pnpm && \ - pnpm i && \ - pnpm run build - -# 下载依赖 -FROM maven:3-eclipse-temurin-21-alpine AS backend-build -COPY pom.xml /build/pom.xml -WORKDIR /build -# fetch all dependencies -RUN mvn dependency:go-offline -B -T 1.5C +FROM --platform=$BUILDPLATFORM docker.io/maven:3.9.9-eclipse-temurin-21-alpine AS build -# 构建后端 -COPY src/ /build/ -COPY .git /build/.git +COPY . /build WORKDIR /build -# 把前端打包好的文件拉来 -COPY --from=frontend-build /build/webui/dist src/main/resources/static -RUN ls -l -RUN apk add --update curl git && \ - mvn -B clean package --file pom.xml -T 1.5C +RUN apk add --update npm curl git && \ + curl -L https://unpkg.com/@pnpm/self-installer | node && \ + cd webui && \ + pnpm i && \ + npm run build && \ + cd .. && \ + mv webui/dist src/main/resources/static && \ + mvn -B clean package --file pom.xml -T 1.5C -P thin-sqlite-packaging -# 最终阶段,只要成品 FROM docker.io/azul/zulu-openjdk-alpine:21.0.4-21.36-jre LABEL maintainer="https://github.com/PBH-BTN/PeerBanHelper" USER 0 ENV TZ=UTC WORKDIR /app VOLUME /tmp -COPY --from=backend-build build/target/PeerBanHelper.jar /app/PeerBanHelper.jar +COPY --from=build build/target/PeerBanHelper.jar /app/PeerBanHelper.jar ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENTRYPOINT ["java","-Xmx386M","-XX:+UseG1GC", "-XX:+UseStringDeduplication","-XX:+ShrinkHeapInSteps","-jar","PeerBanHelper.jar"] +ENTRYPOINT ["java","-Xmx386M","-XX:+UseG1GC", "-XX:+UseStringDeduplication","-XX:+ShrinkHeapInSteps","-jar","PeerBanHelper.jar"] \ No newline at end of file diff --git a/Dockerfile-CI b/Dockerfile-Release similarity index 100% rename from Dockerfile-CI rename to Dockerfile-Release diff --git a/install4j/project.install4j b/install4j/project.install4j index 3d0e7dd558..3e49fbba19 100644 --- a/install4j/project.install4j +++ b/install4j/project.install4j @@ -1,7 +1,7 @@ - + @@ -662,5 +662,17 @@ return console.askYesNo(message, true); + + + + + + + + + + + + diff --git a/pkg/deb/usr/lib/systemd/system/peerbanhelper.service b/pkg/deb/usr/lib/systemd/system/peerbanhelper.service index 77c3b2f9b0..27e0b874d8 100644 --- a/pkg/deb/usr/lib/systemd/system/peerbanhelper.service +++ b/pkg/deb/usr/lib/systemd/system/peerbanhelper.service @@ -4,7 +4,7 @@ After=network.target [Service] User=peerbanhelper WorkingDirectory=/etc/peerbanhelper -ExecStart=/usr/bin/java --Dpbh.datadir=/etc/peerbanhelper Xmx386M -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+ShrinkHeapInSteps -jar /usr/lib/peerbanhelper/PeerBanHelper.jar +ExecStart=/usr/bin/java -Dpbh.datadir=/etc/peerbanhelper -Xmx386M -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+ShrinkHeapInSteps -jar /usr/lib/peerbanhelper/PeerBanHelper.jar Restart=on-failure [Install] WantedBy=multi-user.target diff --git a/pom.xml b/pom.xml index 70e830a156..d2f135de34 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.ghostchu.peerbanhelper peerbanhelper - 6.2.2 + 6.2.3 takari-jar PeerBanHelper