diff --git a/.github/workflows/build.yml b/.github/workflows/build-api.yml similarity index 95% rename from .github/workflows/build.yml rename to .github/workflows/build-api.yml index f7100d71dd..c284756a15 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build-api.yml @@ -1,4 +1,4 @@ -name: Build Docker Image +name: Build Dify API Docker Image on: push: diff --git a/.github/workflows/build-web.yml b/.github/workflows/build-web.yml new file mode 100644 index 0000000000..8d74316a89 --- /dev/null +++ b/.github/workflows/build-web.yml @@ -0,0 +1,66 @@ +name: Build DIFY WEB Docker Image + +on: + push: + tags: + - v* + workflow_dispatch: + +env: + DOCKERHUB_REPO: registry.cn-hangzhou.aliyuncs.com/kindlingx/dify-web + +jobs: + build-image: + strategy: + matrix: + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + registry: registry.cn-hangzhou.aliyuncs.com + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Generate App Version (AMD64) + if: ${{ matrix.os == 'ubuntu-latest' }} + run: | + TAG=$(git describe --tags --exact-match 2>/dev/null || echo "") + if [ -n "$TAG" ]; then + echo "APP_VERSION=$TAG" >> $GITHUB_ENV + else + BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's#[^a-zA-Z0-9._-]#-#g') + COMMIT=$(git rev-parse --short HEAD) + echo "APP_VERSION=${BRANCH}-${COMMIT}" >> $GITHUB_ENV + fi + + - name: Generate App Version (ARM64) + if: ${{ matrix.os == 'ubuntu-24.04-arm' }} + run: | + TAG=$(git describe --tags --exact-match 2>/dev/null || echo "") + if [ -n "$TAG" ]; then + echo "APP_VERSION=$TAG-arm64" >> $GITHUB_ENV + else + BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's#[^a-zA-Z0-9._-]#-#g') + COMMIT=$(git rev-parse --short HEAD) + echo "APP_VERSION=${BRANCH}-${COMMIT}-arm64" >> $GITHUB_ENV + fi + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: ./web + push: true + tags: | + ${{ env.DOCKERHUB_REPO }}:${{ env.APP_VERSION }} \ No newline at end of file