Update catalog-info.yaml #89
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: Container Images | |
| on: | |
| push: | |
| paths: | |
| - '.github/workflows/**' | |
| - 'src/backend/**' | |
| - 'src/frontend/**' | |
| pull_request: | |
| paths: | |
| - 'src/backend/**' | |
| - 'src/frontend/**' | |
| env: | |
| ORGANIZATION: "testruction" | |
| PROJECT_NAME: "fastapi-sqlalchemy-cockroachdb" | |
| jobs: | |
| build: | |
| name: "Build OCI image: ${{ matrix.image }}" | |
| runs-on: ubuntu-20.04 | |
| strategy: | |
| matrix: | |
| image: | |
| - backend | |
| - frontend | |
| steps: | |
| # - uses: FranzDiebold/github-env-vars-action@v1.2.1 | |
| - name: Checkout code base | |
| uses: actions/checkout@v3 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| with: | |
| install: true | |
| - name: Set ENV variables | |
| run: | | |
| echo "VERSION=$(cat ./src/${{ matrix.image }}/VERSION)" >> $GITHUB_ENV | |
| echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-8)" >> $GITHUB_ENV | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: docker.io | |
| username: ${{ vars.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ vars.GH_USERNAME }} | |
| password: ${{ secrets.GH_PACKAGES_TOKEN }} | |
| - name: Build OCI compliant container image | |
| id: container_image_build | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: ./src/${{ matrix.image }} | |
| load: true | |
| build-args: | |
| IMAGE_VERSION="${{ env.VERSION }}" | |
| tags: >- | |
| docker.io/${{ env.ORGANIZATION }}/${{ env.PROJECT_NAME }}-${{ matrix.image }}:${{ env.GITHUB_SHA_SHORT }}, | |
| ghcr.io/${{ env.ORGANIZATION }}/${{ env.PROJECT_NAME }}/${{ matrix.image }}:${{ env.GITHUB_SHA_SHORT }} | |
| file: ./src/${{ matrix.image }}/Dockerfile | |
| platforms: linux/amd64 | |
| - name: Scan for vulnerabilities | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| image-ref: docker.io/${{ env.ORGANIZATION }}/${{ env.PROJECT_NAME }}-${{ matrix.image }}:${{ env.GITHUB_SHA_SHORT }} | |
| format: 'table' | |
| exit-code: '1' | |
| ignore-unfixed: true | |
| vuln-type: 'os,library' | |
| severity: 'CRITICAL,HIGH' | |
| - name: Push image to Docker Hub registry | |
| id: dockerhub | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: ./src/${{ matrix.image }} | |
| push: true | |
| tags: >- | |
| docker.io/${{ env.ORGANIZATION }}/${{ env.PROJECT_NAME }}-${{ matrix.image }}:${{ env.VERSION }}, | |
| docker.io/${{ env.ORGANIZATION }}/${{ env.PROJECT_NAME }}-${{ matrix.image }}:${{ env.GITHUB_SHA_SHORT }}, | |
| docker.io/${{ env.ORGANIZATION }}/${{ env.PROJECT_NAME }}-${{ matrix.image }}:latest | |
| file: ./src/${{ matrix.image }}/Dockerfile | |
| platforms: linux/amd64 | |
| - name: Push image to GitHub Container Registry | |
| id: ghcr | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: ./src/${{ matrix.image }} | |
| push: true | |
| tags: >- | |
| ghcr.io/${{ env.ORGANIZATION }}/${{ env.PROJECT_NAME }}/${{ matrix.image }}:${{ env.VERSION }}, | |
| ghcr.io/${{ env.ORGANIZATION }}/${{ env.PROJECT_NAME }}/${{ matrix.image }}:${{ env.GITHUB_SHA_SHORT }}, | |
| ghcr.io/${{ env.ORGANIZATION }}/${{ env.PROJECT_NAME }}/${{ matrix.image }}:latest | |
| file: ./src/${{ matrix.image }}/Dockerfile | |
| platforms: linux/amd64 |