diff --git a/.github/workflows/docker_beta_v3.yaml b/.github/workflows/docker_beta_v3.yaml new file mode 100644 index 00000000..66f1b59e --- /dev/null +++ b/.github/workflows/docker_beta_v3.yaml @@ -0,0 +1,69 @@ +name: docker beta.v3 + +on: + push: + branches: + - beta.v3 + paths: + - '.github/workflows/docker_beta_v3.yaml' + - 'Makefile' + - 'docker/**' + - 'scripts/**' + - 'apps/cli/**' + - 'apps/pwa/**' + +concurrency: + group: docker-beta-v3 + cancel-in-progress: true + +permissions: + contents: read + +jobs: + build-and-push: + if: github.repository == 'mebtte/cicada' + name: Build And Push Docker Image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.TOKEN }} + + - uses: actions/setup-node@v4 + with: + node-version: 24 + cache: npm + cache-dependency-path: apps/pwa/package-lock.json + + - uses: actions/setup-go@v5 + with: + go-version-file: apps/cli/go.mod + + - uses: docker/setup-qemu-action@v3 + + - uses: docker/setup-buildx-action@v3 + + - name: Build Docker binaries + run: make docker + + - uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - uses: docker/build-push-action@v6 + with: + context: . + file: docker/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/cicada:beta.v3 + + - name: Update Docker Hub overview + uses: peter-evans/dockerhub-description@v5 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + repository: ${{ secrets.DOCKERHUB_USERNAME }}/cicada + readme-filepath: ./docker/docker.md diff --git a/Makefile b/Makefile index 75f03c6f..ff09d346 100644 --- a/Makefile +++ b/Makefile @@ -79,11 +79,13 @@ release: pwa ffmpeg-bundles $(BUILD_DIR)/linux-amd64 \ $(BUILD_DIR)/linux-arm64 -## 构建 Linux x64 二进制 (供 Docker 使用, 不压缩) -docker: pwa ffmpeg-bundle-linux-amd64 +## 构建 Linux 多架构二进制 (供 Docker buildx 使用, 不压缩) +docker: pwa ffmpeg-bundle-linux-amd64 ffmpeg-bundle-linux-arm64 rm -rf $(BUILD_DIR) - mkdir -p $(BUILD_DIR) - $(call build_cli,linux,amd64,$(BUILD_DIR)/cicada) + mkdir -p $(BUILD_DIR)/linux-amd64 + $(call build_cli,linux,amd64,$(BUILD_DIR)/linux-amd64/cicada) + mkdir -p $(BUILD_DIR)/linux-arm64 + $(call build_cli,linux,arm64,$(BUILD_DIR)/linux-arm64/cicada) @echo 'skip compression on docker building.' ## 清理构建产物 diff --git a/docker/Dockerfile b/docker/Dockerfile index a8ed4e12..9d36f669 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,9 @@ FROM ubuntu -COPY build/cicada /bin/cicada +ARG TARGETOS=linux +ARG TARGETARCH=amd64 + +COPY build/${TARGETOS}-${TARGETARCH}/cicada /bin/cicada ENTRYPOINT ["/bin/cicada"] LABEL org.opencontainers.image.title="cicada" \ diff --git a/docker/docker.md b/docker/docker.md index f36a495f..a232bf4d 100644 --- a/docker/docker.md +++ b/docker/docker.md @@ -3,6 +3,4 @@ A multi-user music service for self-hosting. For more information, please see [here](https://github.com/mebtte/cicada). ![version](https://img.shields.io/github/v/release/mebtte/cicada?style=for-the-badge) -![release build](https://img.shields.io/github/actions/workflow/status/mebtte/cicada/build_and_release.yaml?label=release%20build&style=for-the-badge) -![docker build](https://img.shields.io/github/actions/workflow/status/mebtte/cicada/docker_build_and_push.yaml?label=docker%20build&style=for-the-badge) ![license](https://img.shields.io/github/license/mebtte/cicada?style=for-the-badge) diff --git a/docker/docker_build_and_push.sh b/docker/docker_build_and_push.sh deleted file mode 100755 index 7e41904c..00000000 --- a/docker/docker_build_and_push.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -set -e - -ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" - -"$ROOT_DIR/build.sh" docker -docker buildx build -t mebtte/cicada:$1 -f "$ROOT_DIR/docker/Dockerfile" --platform=linux/amd64 --push "$ROOT_DIR" diff --git a/readme.md b/readme.md index 146a33de..c2cdabb6 100644 --- a/readme.md +++ b/readme.md @@ -3,8 +3,6 @@ A multi-user music service for self-hosting. ![version](https://img.shields.io/github/v/release/mebtte/cicada?style=for-the-badge) -![release build](https://img.shields.io/github/actions/workflow/status/mebtte/cicada/build_and_release.yaml?label=release%20build&style=for-the-badge) -![docker build](https://img.shields.io/github/actions/workflow/status/mebtte/cicada/docker_build_and_push.yaml?label=docker%20build&style=for-the-badge) ![license](https://img.shields.io/github/license/mebtte/cicada?style=for-the-badge) todo: screenshot