Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨增加‘增强’标签;调整github 镜像构建内容 #717

Merged
merged 10 commits into from
Nov 25, 2022
44 changes: 36 additions & 8 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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. 检出
Expand All @@ -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值
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("初始化语言...")
Expand Down
19 changes: 19 additions & 0 deletions server/projects/main/bin/wait.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"