diff --git a/.github/workflows/manual-release-docker-packages.yml b/.github/workflows/manual-release-docker-packages.yml new file mode 100644 index 00000000..dd1fe41c --- /dev/null +++ b/.github/workflows/manual-release-docker-packages.yml @@ -0,0 +1,88 @@ +name: Manual Release Docker Packages + +on: + workflow_dispatch: + +jobs: + build-docker-archives: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: 'maven' + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build server package + run: mvn -B -pl server -DskipTests package + + - name: Prepare release Dockerfile + run: | + cat > Dockerfile.release <<'EOF' + FROM ubuntu:24.04 + + RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.aliyun.com@g' /etc/apt/sources.list.d/ubuntu.sources && \ + sed -i 's@//security.ubuntu.com@//mirrors.aliyun.com@g' /etc/apt/sources.list.d/ubuntu.sources && \ + sed -i 's@//ports.ubuntu.com@//mirrors.aliyun.com@g' /etc/apt/sources.list.d/ubuntu.sources && \ + apt-get update && \ + export DEBIAN_FRONTEND=noninteractive && \ + apt-get install -y --no-install-recommends openjdk-21-jre tzdata locales xfonts-utils fontconfig libreoffice-nogui && \ + echo 'Asia/Shanghai' > /etc/timezone && \ + ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ + localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8 && \ + locale-gen zh_CN.UTF-8 && \ + apt-get install -y --no-install-recommends ttf-mscorefonts-installer && \ + apt-get install -y --no-install-recommends ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy && \ + apt-get autoremove -y && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + + COPY docker/kkfileview-base/fonts/ /usr/share/fonts/chinese/ + + RUN cd /usr/share/fonts/chinese && \ + mkfontscale && \ + mkfontdir && \ + fc-cache -fv + + ENV LANG=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8 + ADD server/target/kkFileView-*.tar.gz /opt/ + ENV KKFILEVIEW_BIN_FOLDER=/opt/kkFileView-5.0.0/bin + ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dspring.config.location=/opt/kkFileView-5.0.0/config/application.properties","-jar","/opt/kkFileView-5.0.0/bin/kkFileView-5.0.0.jar"] + EOF + + - name: Build amd64 docker archive + run: | + mkdir -p dist + docker buildx build \ + --platform linux/amd64 \ + --provenance=false \ + --output type=docker,dest=dist/kkFileView-5.0.0-docker_x64.tar \ + -f Dockerfile.release \ + . + + - name: Build arm64 docker archive + run: | + docker buildx build \ + --platform linux/arm64 \ + --provenance=false \ + --output type=docker,dest=dist/kkFileView-5.0.0-docker_aarch64.tar \ + -f Dockerfile.release \ + . + + - name: Upload docker archives + uses: actions/upload-artifact@v4 + with: + name: kkfileview-docker-release + path: dist/kkFileView-5.0.0-docker_*.tar + retention-days: 7