mirror of
https://github.com/jihe520/MathModelAgent.git
synced 2026-09-19 08:09:48 +08:00
1921f9da0c
add apikeydialog 在网页配置 apikey 不需要再环境变量 update docker file and github action change prompt 跳过问题核验导致不非数学建模问题
139 lines
4.3 KiB
YAML
139 lines
4.3 KiB
YAML
# name: Build and Push Docker Image
|
|
|
|
# on:
|
|
# push:
|
|
# branches:
|
|
# - main
|
|
# paths:
|
|
# - 'backend/**'
|
|
# - 'frontend/**'
|
|
# - 'docker-compose.yml'
|
|
# - '.github/workflows/docker-build-push.yml'
|
|
# pull_request:
|
|
# branches:
|
|
# - main
|
|
# paths:
|
|
# - 'backend/**'
|
|
# - 'frontend/**'
|
|
# - 'docker-compose.yml'
|
|
# - '.github/workflows/docker-build-push.yml'
|
|
|
|
# env:
|
|
# REGISTRY: docker.io
|
|
# BACKEND_IMAGE_NAME: mathmodelagent-backend
|
|
# FRONTEND_IMAGE_NAME: mathmodelagent-frontend
|
|
|
|
# jobs:
|
|
# build-backend:
|
|
# runs-on: ubuntu-latest
|
|
# outputs:
|
|
# image-tag: ${{ steps.meta.outputs.tags }}
|
|
# image-digest: ${{ steps.build.outputs.digest }}
|
|
|
|
# steps:
|
|
# - name: Checkout code
|
|
# uses: actions/checkout@v4
|
|
|
|
# - name: Set up Docker Buildx
|
|
# uses: docker/setup-buildx-action@v3
|
|
|
|
# - name: Log in to Docker Hub
|
|
# if: github.event_name != 'pull_request'
|
|
# uses: docker/login-action@v3
|
|
# with:
|
|
# registry: ${{ env.REGISTRY }}
|
|
# username: ${{ secrets.DOCKER_USERNAME }}
|
|
# password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
# - name: Extract metadata for backend
|
|
# id: meta
|
|
# uses: docker/metadata-action@v5
|
|
# with:
|
|
# images: ${{ env.REGISTRY }}/${{ secrets.DOCKER_USERNAME }}/${{ env.BACKEND_IMAGE_NAME }}
|
|
# tags: |
|
|
# type=ref,event=branch
|
|
# type=ref,event=pr
|
|
# type=sha,prefix={{branch}}-
|
|
# type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
# - name: Build and push backend Docker image
|
|
# id: build
|
|
# uses: docker/build-push-action@v5
|
|
# with:
|
|
# context: ./backend
|
|
# file: ./backend/Dockerfile
|
|
# push: ${{ github.event_name != 'pull_request' }}
|
|
# tags: ${{ steps.meta.outputs.tags }}
|
|
# labels: ${{ steps.meta.outputs.labels }}
|
|
# cache-from: type=gha
|
|
# cache-to: type=gha,mode=max
|
|
# platforms: linux/amd64,linux/arm64
|
|
|
|
# build-frontend:
|
|
# runs-on: ubuntu-latest
|
|
# outputs:
|
|
# image-tag: ${{ steps.meta.outputs.tags }}
|
|
# image-digest: ${{ steps.build.outputs.digest }}
|
|
|
|
# steps:
|
|
# - name: Checkout code
|
|
# uses: actions/checkout@v4
|
|
|
|
# - name: Set up Docker Buildx
|
|
# uses: docker/setup-buildx-action@v3
|
|
|
|
# - name: Log in to Docker Hub
|
|
# if: github.event_name != 'pull_request'
|
|
# uses: docker/login-action@v3
|
|
# with:
|
|
# registry: ${{ env.REGISTRY }}
|
|
# username: ${{ secrets.DOCKER_USERNAME }}
|
|
# password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
# - name: Extract metadata for frontend
|
|
# id: meta
|
|
# uses: docker/metadata-action@v5
|
|
# with:
|
|
# images: ${{ env.REGISTRY }}/${{ secrets.DOCKER_USERNAME }}/${{ env.FRONTEND_IMAGE_NAME }}
|
|
# tags: |
|
|
# type=ref,event=branch
|
|
# type=ref,event=pr
|
|
# type=sha,prefix={{branch}}-
|
|
# type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
# - name: Build and push frontend Docker image
|
|
# id: build
|
|
# uses: docker/build-push-action@v5
|
|
# with:
|
|
# context: ./frontend
|
|
# file: ./frontend/Dockerfile
|
|
# push: ${{ github.event_name != 'pull_request' }}
|
|
# tags: ${{ steps.meta.outputs.tags }}
|
|
# labels: ${{ steps.meta.outputs.labels }}
|
|
# cache-from: type=gha
|
|
# cache-to: type=gha,mode=max
|
|
# platforms: linux/amd64,linux/arm64
|
|
|
|
# security-scan:
|
|
# runs-on: ubuntu-latest
|
|
# needs: [build-backend, build-frontend]
|
|
# if: github.event_name != 'pull_request'
|
|
|
|
# strategy:
|
|
# matrix:
|
|
# component: [backend, frontend]
|
|
|
|
# steps:
|
|
# - name: Run Trivy vulnerability scanner
|
|
# uses: aquasecurity/trivy-action@master
|
|
# with:
|
|
# image-ref: ${{ needs[format('build-{0}', matrix.component)].outputs.image-tag }}
|
|
# format: 'sarif'
|
|
# output: 'trivy-results-${{ matrix.component }}.sarif'
|
|
|
|
# - name: Upload Trivy scan results to GitHub Security tab
|
|
# uses: github/codeql-action/upload-sarif@v3
|
|
# if: always()
|
|
# with:
|
|
# sarif_file: 'trivy-results-${{ matrix.component }}.sarif'
|