Merge pull request #26 from MgAlNa3PO4/main #3
This file contains hidden or 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: 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' |