diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index af49a760a..abd7421d9 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -9,6 +9,34 @@ on: jobs: build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - dockerfile: ./server/projects/main/Dockerfile + context: ./server/projects/main/ + image: tca-main + - dockerfile: ./server/projects/analysis/Dockerfile + context: ./server/projects/analysis/ + image: tca-analysis + - dockerfile: ./server/projects/login/Dockerfile + context: ./server/projects/login/ + image: tca-login + - dockerfile: ./server/projects/file/Dockerfile + context: ./server/projects/file/ + image: tca-file + - dockerfile: ./server/projects/scmproxy/Dockerfile + context: ./server/projects/scmproxy/ + image: tca-scmproxy + - dockerfile: ./server/dockerconfs/Dockerfile-nginx-mirror + context: ./web/tca-deploy-source/ + image: tca-web + - dockerfile: ./client/Dockerfile + context: ./client/ + image: tca-client + - dockerfile: ./Dockerfile + context: . + image: tca steps: # 1. 检出 @@ -24,32 +52,32 @@ jobs: # 3. 设置 docker 环境 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 # 4. 构建并推送镜像 - name: Build and push with latest tag and release tag id: docker_build uses: docker/build-push-action@v2 with: - context: ./ - file: ./Dockerfile + context: ${{ matrix.context }} + file: ${{ matrix.dockerfile }} platforms: linux/amd64, linux/arm64 push: true - tags: ${{ secrets.DOCKER_HUB_USERNAME }}/tca:latest, ${{ secrets.DOCKER_HUB_USERNAME }}/tca:${{ github.event.release.name }} + tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:latest, ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:${{ github.event.release.name }} if: ${{ github.event_name == 'release' }} - name: Build and push with beta tag id: docker_build_beta uses: docker/build-push-action@v2 with: - context: ./ - file: ./Dockerfile + context: ${{ matrix.context }} + file: ${{ matrix.dockerfile }} platforms: linux/amd64, linux/arm64 push: true - tags: ${{ secrets.DOCKER_HUB_USERNAME }}/tca:beta + tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:beta if: ${{ github.event_name == 'workflow_dispatch' }} # 5. 打印docker镜像SHA256值 diff --git a/server/projects/main/apps/base/management/commands/initializedb_open.py b/server/projects/main/apps/base/management/commands/initializedb_open.py index b5113fa89..a57d02fee 100644 --- a/server/projects/main/apps/base/management/commands/initializedb_open.py +++ b/server/projects/main/apps/base/management/commands/initializedb_open.py @@ -42,7 +42,7 @@ def handle(self, *args, **options): ExecTag.objects.get_or_create(name=name) ExecTag.objects.filter(name__in=tag_names).update(public=True) self.stdout.write("新增规则标签...") - label_names = ["基础", "推荐", "通用", "开源", "规范", "安全"] + label_names = ["基础", "推荐", "通用", "开源", "规范", "安全", "增强"] for name in label_names: conf_models.Label.objects.get_or_create(name=name) self.stdout.write("初始化语言...") diff --git a/server/projects/main/bin/wait.sh b/server/projects/main/bin/wait.sh new file mode 100644 index 000000000..5dd650319 --- /dev/null +++ b/server/projects/main/bin/wait.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +function wait_for_service(){ + SERVICE=${1/:/' '} + until nc -vz $SERVICE > /dev/null; do + >&2 echo "$SERVICE is unavailable - sleeping" + sleep 2 + done + >&2 echo "$SERVICE is up" +} + +function wait_for() { + for service in "$@" + do + wait_for_service $service + done +} + +wait_for "$@" \ No newline at end of file