|
| 1 | +name: Docker build |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - 'docker/**' |
| 7 | + - '.github/workflows/docker-build.yaml' |
| 8 | + |
| 9 | +jobs: |
| 10 | + docker-build: |
| 11 | + name: 'Build docker image: Node ${{ matrix.node }}' |
| 12 | + runs-on: ubuntu-latest |
| 13 | + timeout-minutes: 15 |
| 14 | + permissions: |
| 15 | + contents: read |
| 16 | + security-events: write |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + include: |
| 20 | + - node: 18 |
| 21 | + platforms: linux/amd64,linux/arm64,linux/arm/v7 |
| 22 | + - node: 20 |
| 23 | + platforms: linux/amd64,linux/arm64,linux/arm/v7 |
| 24 | + - node: 24 |
| 25 | + platforms: linux/amd64,linux/arm64 |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 29 | + |
| 30 | + - name: Set up Docker |
| 31 | + uses: docker/setup-docker-action@0234bb73ccb40f0c430b795634f9247e2b5c2d23 #v5.2.0 |
| 32 | + with: |
| 33 | + daemon-config: | |
| 34 | + { |
| 35 | + "features": { |
| 36 | + "containerd-snapshotter": true |
| 37 | + } |
| 38 | + } |
| 39 | +
|
| 40 | + - name: Set up QEMU |
| 41 | + uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0 |
| 42 | + |
| 43 | + - name: Build Docker image |
| 44 | + uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 |
| 45 | + with: |
| 46 | + context: . |
| 47 | + file: docker/Dockerfile |
| 48 | + platforms: ${{ matrix.platforms }} |
| 49 | + tags: flowfuse-device-agent-pr:${{ matrix.node }}-scan |
| 50 | + push: false |
| 51 | + load: true |
| 52 | + build-args: | |
| 53 | + NODE_VERSION=${{ matrix.node }} |
| 54 | +
|
| 55 | + - name: Perform SAST scan |
| 56 | + uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 |
| 57 | + with: |
| 58 | + image-ref: flowfuse-device-agent-pr:${{ matrix.node }}-scan |
| 59 | + trivy-config: .github/trivy.yaml |
| 60 | + output: 'sast-results.sarif' |
| 61 | + |
| 62 | + - name: Upload scan results |
| 63 | + uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2 |
| 64 | + with: |
| 65 | + sarif_file: sast-results.sarif |
0 commit comments