Skip to content

Commit

Permalink
Build code scanner image when Dockerfile changed
Browse files Browse the repository at this point in the history
  • Loading branch information
anhappdev committed Nov 6, 2023
1 parent bf574f9 commit 0c588ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
23 changes: 10 additions & 13 deletions .github/workflows/code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,23 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check if base Dockerfile changed
id: changed-base
uses: tj-actions/changed-files@v35
- name: Check if Dockerfile changed
id: changed
uses: tj-actions/changed-files@v40
with:
files: flutter/android/docker/Dockerfile
files: |
flutter/android/docker/Dockerfile
tools/scanner/Dockerfile
- name: Extract metadata for base image
id: meta-base
if: steps.changed-base.outputs.any_changed == 'true'
if: steps.changed.outputs.any_changed == 'true'
uses: docker/metadata-action@v4
with:
images: ghcr.io/mlcommons/mobile_app_open-base
flavor: latest=true
tags: type=raw,value=${{ github.run_number }}
- name: Build and push base image
if: steps.changed-base.outputs.any_changed == 'true'
if: steps.changed.outputs.any_changed == 'true'
uses: docker/build-push-action@v4
with:
context: flutter/android/docker
Expand All @@ -62,20 +64,15 @@ jobs:
labels: ${{ steps.meta-base.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Check if scanner Dockerfile changed
id: changed-scanner
uses: tj-actions/changed-files@v35
with:
files: tools/scanner/Dockerfile
- name: Extract metadata for scanner image
id: meta-scanner
if: steps.changed-scanner.outputs.any_changed == 'true'
if: steps.changed.outputs.any_changed == 'true'
uses: docker/metadata-action@v4
with:
images: ghcr.io/mlcommons/mobile_app_open-scanner
flavor: latest=true
- name: Build and push scanner image
if: steps.changed-scanner.outputs.any_changed == 'true'
if: steps.changed.outputs.any_changed == 'true'
uses: docker/build-push-action@v4
with:
context: tools/scanner
Expand Down
1 change: 1 addition & 0 deletions tools/scanner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ ENV NODE_ENV="production"
RUN curl --proto '=https' -fsSL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get update && apt-get install -y --no-install-recommends nodejs && node -v
RUN npm install --ignore-scripts --location=global [email protected] && npm --version

0 comments on commit 0c588ea

Please sign in to comment.