|
| 1 | +--- |
| 2 | +name: rockylinux10 |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + push: |
| 7 | + paths: |
| 8 | + - 'rockylinux10/**' |
| 9 | + - '.github/workflows/rockylinux10.yml' |
| 10 | + schedule: |
| 11 | + - cron: '10 6,15 * * 1,6' |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +permissions: write-all |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ${{ github.ref }}-${{ github.workflow }} |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +jobs: |
| 21 | + # Test the image builds and works correctly. |
| 22 | + test: |
| 23 | + name: Test rockylinux10 |
| 24 | + runs-on: ${{ matrix.os }} |
| 25 | + strategy: |
| 26 | + matrix: |
| 27 | + os: [ubuntu-22.04] |
| 28 | + |
| 29 | + steps: |
| 30 | + |
| 31 | + |
| 32 | + - name: Test building image. |
| 33 | + run: cd rockylinux10 && docker build -t rockylinux10 . |
| 34 | + |
| 35 | + - name: Run the built image. |
| 36 | + run: docker run --name test-container -d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw rockylinux10 |
| 37 | + |
| 38 | + # If on master branch, build and release image. |
| 39 | + release: |
| 40 | + name: Release |
| 41 | + runs-on: ubuntu-latest |
| 42 | + needs: test |
| 43 | + if: github.ref == 'refs/heads/master' |
| 44 | + |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v4 |
| 47 | + - name: Docker meta |
| 48 | + id: meta |
| 49 | + uses: docker/metadata-action@v5 |
| 50 | + with: |
| 51 | + # list of Docker images to use as base name for tags |
| 52 | + images: | |
| 53 | + ${{ github.repository }}:rockylinux10 |
| 54 | + # generate Docker tags based on the following events/attributes |
| 55 | + tags: | |
| 56 | + type=schedule |
| 57 | + type=ref,event=branch |
| 58 | + type=ref,event=pr |
| 59 | + type=semver,pattern={{version}} |
| 60 | + type=semver,pattern={{major}}.{{minor}} |
| 61 | + type=semver,pattern={{major}} |
| 62 | + type=sha |
| 63 | + - uses: docker/setup-qemu-action@v3 |
| 64 | + - uses: docker/setup-buildx-action@v3 |
| 65 | + |
| 66 | + - name: Login to DockerHub |
| 67 | + if: github.event_name != 'pull_request' |
| 68 | + uses: docker/login-action@v3 |
| 69 | + with: |
| 70 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 71 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 72 | + |
| 73 | + - name: Login to GHCR |
| 74 | + if: github.event_name != 'pull_request' |
| 75 | + uses: docker/login-action@v3 |
| 76 | + with: |
| 77 | + registry: ghcr.io |
| 78 | + username: ${{ github.repository_owner }} |
| 79 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + |
| 81 | + - name: Build and push image. |
| 82 | + uses: docker/build-push-action@v5 |
| 83 | + with: |
| 84 | + context: rockylinux10/ |
| 85 | + sbom: true |
| 86 | + provenance: mode=max |
| 87 | + file: rockylinux10/Dockerfile |
| 88 | + platforms: linux/amd64, linux/arm64 |
| 89 | + push: ${{ github.event_name != 'pull_request' }} |
| 90 | + tags: | |
| 91 | + ${{ github.repository }}:rockylinux10 |
| 92 | + labels: ${{ steps.meta.outputs.labels }} |
| 93 | + |
| 94 | + - name: Docker Scout |
| 95 | + id: docker-scout |
| 96 | + if: ${{ github.event_name == 'pull_request' }} |
| 97 | + |
| 98 | + with: |
| 99 | + command: quickview,cves,recommendations,sbom,environment |
| 100 | + image: ${{ steps.meta.outputs.tags }} |
| 101 | + environment: prod |
| 102 | + organization: shadownet |
| 103 | + only-severities: critical,high,medium |
| 104 | + exit-code: true |
| 105 | + only-fixed: true |
0 commit comments