v1.10.0 #25
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: TCA docker image build and push | |
on: | |
release: | |
types: [published] | |
branches: | |
- 'main' | |
workflow_dispatch: | |
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. 检出 | |
- name: Check Out | |
uses: actions/checkout@v2 | |
# 2. 登陆 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
# 3. 下载二进制文件 | |
- name: Download Binary Files | |
run: bash ./scripts/base/install_bin.sh | |
# 4. 设置 docker 环境 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# 5. 构建并推送镜像 | |
- name: Build and push with latest tag and release tag | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
context: ${{ matrix.context }} | |
file: ${{ matrix.dockerfile }} | |
platforms: linux/amd64, linux/arm64 | |
push: true | |
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: ${{ matrix.context }} | |
file: ${{ matrix.dockerfile }} | |
platforms: linux/amd64, linux/arm64 | |
push: true | |
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:beta | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
# 6. 打印docker镜像SHA256值 | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |