Skip to content

Commit

Permalink
Merge pull request #717 from Lingghh/dev/add_enhance_tag
Browse files Browse the repository at this point in the history
✨增加‘增强’标签;调整github 镜像构建内容
  • Loading branch information
cyw3 authored Nov 25, 2022
2 parents aecec56 + e426dc9 commit 5ddbe44
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 9 deletions.
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 "$@"

0 comments on commit 5ddbe44

Please sign in to comment.