fix(Dockerfile): use non root user for building container image #19
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: CICD Pipeline | |
| on: | |
| push: | |
| branches: [ 'main' ] | |
| pull_request: | |
| jobs: | |
| # build: | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - uses: actions/setup-java@v4 | |
| # with: | |
| # distribution: adopt | |
| # java-version: 21 | |
| # check-latest: true | |
| # - name: Cached Gradle packages | |
| # uses: actions/cache@v4 | |
| # with: | |
| # key: ${{ runner.os }}-v1-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| # path: | | |
| # ~/.gradle/caches | |
| # ~/.gradle/wrapper | |
| # - run: ( ./gradlew build -x test ) | |
| # name: "Executing build" | |
| # unit-test: | |
| # runs-on: ubuntu-latest | |
| # # needs: build | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - uses: actions/setup-java@v4 | |
| # with: | |
| # distribution: adopt | |
| # java-version: 21 | |
| # check-latest: true | |
| # - name: Cached Gradle packages | |
| # uses: actions/cache@v4 | |
| # with: | |
| # key: ${{ runner.os }}-v1-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| # path: | | |
| # ~/.gradle/caches | |
| # ~/.gradle/wrapper | |
| # - run: ( ./gradlew test ) | |
| # name: "Executing tests" | |
| # - run: ( ./gradlew jacocoTestCoverageVerification ) | |
| # name: "Code coverage" | |
| # mutation-test: | |
| # runs-on: ubuntu-latest | |
| # # needs: build | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - uses: actions/setup-java@v4 | |
| # with: | |
| # distribution: adopt | |
| # java-version: 21 | |
| # check-latest: true | |
| # - name: Cached Gradle packages | |
| # uses: actions/cache@v4 | |
| # with: | |
| # key: ${{ runner.os }}-v1-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| # path: | | |
| # ~/.gradle/caches | |
| # ~/.gradle/wrapper | |
| # - run: ( ./gradlew pitest ) | |
| # name: "Executing mutation tests" | |
| # dependency-vulnerability-analysis: | |
| # runs-on: ubuntu-latest | |
| # # needs: build | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - uses: actions/setup-java@v4 | |
| # with: | |
| # distribution: adopt | |
| # java-version: 21 | |
| # check-latest: true | |
| # - name: Cached Gradle packages | |
| # uses: actions/cache@v4 | |
| # with: | |
| # key: ${{ runner.os }}-v1-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| # path: | | |
| # ~/.gradle/caches | |
| # ~/.gradle/wrapper | |
| # - run: ( ./gradlew dependencyCheckAnalyze -PUseNVDKey ) | |
| # name: "Executing dependency vulnerability checks" | |
| # env: | |
| # NVD_API_KEY: ${{ secrets.NVD_API_KEY }} | |
| sast-code-snyk: | |
| runs-on: ubuntu-latest | |
| # needs: build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run Snyk to static code analysis for vulnerabilities | |
| uses: snyk/actions/maven-3-jdk-21@master | |
| env: | |
| SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
| with: | |
| args: --severity-threshold=high | |
| sast-dockerfile-trivy-hadolint: | |
| runs-on: ubuntu-latest | |
| # needs: build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: hadolint/[email protected] | |
| with: | |
| dockerfile: Dockerfile | |
| failure-threshold: error | |
| - name: Run Trivy vulnerability for Dockerfile | |
| uses: aquasecurity/[email protected] | |
| with: | |
| scan-type: config | |
| scan-ref: './' | |
| exit-code: 1 | |
| severity: 'CRITICAL,HIGH' | |
| trivy-config: ./config/trivy/trivy.yaml |