-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
85 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,55 @@ | ||
name: Build with provenance | ||
name: Build package and images | ||
|
||
on: | ||
- push | ||
push: | ||
branches: | ||
- '*' | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
build: | ||
build-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
actions: read | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Set up JDK 11 for x64 | ||
- name: Set up JDK 17 for x64 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'liberica' | ||
architecture: x64 | ||
- name: Maven build | ||
run: ./mvnw --batch-mode --update-snapshots verify | ||
run: ./mvnw --batch-mode --update-snapshots verify | ||
- name: Run Snyk to check for vulnerabilities | ||
uses: snyk/actions/maven-3-jdk-17@master | ||
continue-on-error: true # To make sure that SARIF upload gets called | ||
env: | ||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | ||
with: | ||
args: --sarif-file-output=snyk.sarif | ||
- name: Upload result to GitHub Code Scanning | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: snyk.sarif | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USER }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
tags: andifalk/supply-chain-security:latest | ||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: 'docker.io/andifalk/supply-chain-security:latest' | ||
severity: 'CRITICAL,HIGH' | ||
format: 'sarif' | ||
output: 'trivy-results.sarif' | ||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: 'trivy-results.sarif' |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Publish package and image to GitHub Packages | ||
|
||
on: | ||
release: | ||
types: [created] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'liberica' | ||
- name: Publish package | ||
run: mvn --batch-mode deploy | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM eclipse-temurin:17-jre as builder | ||
WORKDIR application | ||
ARG JAR_FILE=target/*.jar | ||
COPY ${JAR_FILE} application.jar | ||
RUN java -Djarmode=layertools -jar application.jar extract | ||
|
||
FROM eclipse-temurin:17-jre | ||
RUN addgroup --system javauser && adduser --gid 101 --home /home/javauser javauser | ||
USER javauser | ||
WORKDIR application | ||
COPY --from=builder application/dependencies/ ./ | ||
COPY --from=builder application/spring-boot-loader/ ./ | ||
COPY --from=builder application/snapshot-dependencies/ ./ | ||
COPY --from=builder application/application/ ./ | ||
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] |
This file contains 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