-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Milton Moura <[email protected]>
- Loading branch information
Showing
7 changed files
with
123 additions
and
9 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 |
---|---|---|
|
@@ -90,10 +90,31 @@ jobs: | |
with: | ||
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'pull_request' && secrets.GH_APP_OS_APP_ID != '' }} | ||
context: ./matrix-meetings-widget/ | ||
build-contexts: | | ||
root=./ | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64,linux/s390x | ||
|
||
- name: Run Trivy to get an SBOM report of the container | ||
env: | ||
IMAGE_REF: ${{ env.DOCKER_IMAGE }}@${{ steps.dockerBuild.outputs.digest }} | ||
uses: aquasecurity/[email protected] | ||
with: | ||
scan-type: 'image' | ||
scanners: 'license' | ||
format: 'spdx-json' | ||
output: 'matrix-meetings-widget.sbom.spdx.json' | ||
image-ref: ${{ env.IMAGE_REF }} | ||
github-pat: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload SBOM report as a build artifcat | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: matrix-meetings-widget-sbom-spdx-report | ||
path: 'matrix-meetings-widget.sbom.spdx.json' | ||
retention-days: 30 | ||
|
||
build-bot: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
|
@@ -182,6 +203,25 @@ jobs: | |
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64,linux/s390x | ||
|
||
- name: Run Trivy to get an SBOM report of the container | ||
env: | ||
IMAGE_REF: ${{ env.DOCKER_IMAGE }}@${{ steps.dockerBuild.outputs.digest }} | ||
uses: aquasecurity/[email protected] | ||
with: | ||
scan-type: 'image' | ||
scanners: 'license' | ||
format: 'spdx-json' | ||
output: 'matrix-meetings-bot.sbom.spdx.json' | ||
image-ref: ${{ env.IMAGE_REF }} | ||
github-pat: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload SBOM report as a build artifcat | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: matrix-meetings-bot-sbom-spdx-report | ||
path: 'matrix-meetings-bot.sbom.spdx.json' | ||
retention-days: 30 | ||
|
||
run-changesets: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
|
@@ -254,6 +294,8 @@ jobs: | |
id: dockerBuildWidget | ||
with: | ||
context: ./matrix-meetings-widget/ | ||
build-contexts: | | ||
root=./ | ||
- name: Docker build bot | ||
uses: docker/build-push-action@v6 | ||
|
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 |
---|---|---|
|
@@ -13,7 +13,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
permissions: | ||
contents: read | ||
contents: write | ||
packages: write | ||
id-token: write | ||
env: | ||
|
@@ -68,6 +68,25 @@ jobs: | |
labels: ${{ steps.meta-new-tags.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64,linux/s390x | ||
|
||
- name: Run Trivy to get an SBOM report of the container | ||
env: | ||
IMAGE_REF: ${{ env.DOCKER_IMAGE }}@${{ steps.build_and_push.outputs.digest }} | ||
uses: aquasecurity/[email protected] | ||
with: | ||
scan-type: 'image' | ||
scanners: 'license' | ||
format: 'spdx-json' | ||
output: 'sbom.spdx.json' | ||
image-ref: ${{ env.IMAGE_REF }} | ||
github-pat: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload SBOM to release assets | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.ref_name }} | ||
run: | | ||
gh release upload "$tag" sbom.spdx.json --repo="$GITHUB_REPOSITORY" | ||
- name: Sign the images with GitHub OIDC Token | ||
env: | ||
DIGEST: ${{ steps.build_and_push.outputs.digest }} | ||
|
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 |
---|---|---|
|
@@ -13,7 +13,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
permissions: | ||
contents: read | ||
contents: write | ||
packages: write | ||
id-token: write | ||
env: | ||
|
@@ -68,6 +68,25 @@ jobs: | |
labels: ${{ steps.meta-new-tags.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64,linux/s390x | ||
|
||
- name: Run Trivy to get an SBOM report of the container | ||
env: | ||
IMAGE_REF: ${{ env.DOCKER_IMAGE }}@${{ steps.build_and_push.outputs.digest }} | ||
uses: aquasecurity/[email protected] | ||
with: | ||
scan-type: 'image' | ||
scanners: 'license' | ||
format: 'spdx-json' | ||
output: 'sbom.spdx.json' | ||
image-ref: ${{ env.IMAGE_REF }} | ||
github-pat: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload SBOM to release assets | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.ref_name }} | ||
run: | | ||
gh release upload "$tag" sbom.spdx.json --repo="$GITHUB_REPOSITORY" | ||
- name: Sign the images with GitHub OIDC Token | ||
env: | ||
DIGEST: ${{ steps.build_and_push.outputs.digest }} | ||
|
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
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,25 +1,38 @@ | ||
FROM node:20-bookworm-slim AS node_modules | ||
FROM aquasec/trivy:latest AS scanner | ||
|
||
# Copy yarn.lock to run SBOM scan | ||
COPY yarn.lock /tmp | ||
RUN trivy fs --format spdx-json --scanners "license" /tmp/yarn.lock > /tmp/sbom.spdx.json | ||
|
||
FROM node:20-bookworm-slim AS builder | ||
|
||
WORKDIR /build | ||
|
||
COPY package.json yarn.lock ./ | ||
COPY matrix-meetings-bot/package.json ./matrix-meetings-bot/ | ||
COPY packages/calendar/package.json ./packages/calendar/package.json | ||
COPY packages/calendar/lib ./packages/calendar/lib | ||
RUN yarn install --production --frozen-lockfile --network-timeout 1000000 | ||
|
||
# Runtime image | ||
FROM node:20-bookworm-slim | ||
|
||
ENV NODE_ENV=production | ||
WORKDIR /app | ||
|
||
# update npm to address CVE-2024-21538 | ||
RUN npm install -g [email protected] | ||
|
||
# Add SBOM to the public folder | ||
COPY --from=scanner /tmp/sbom.spdx.json /usr/local/share/doc/matrix-meetings-bot.sbom.spdx.json | ||
|
||
RUN set -x\ | ||
&& mkdir /app/storage \ | ||
&& chown -R 101:0 /app/storage \ | ||
&& chmod -R g+w /app/storage | ||
USER 101 | ||
COPY --from=node_modules /build/node_modules/ ./node_modules | ||
COPY --from=node_modules /build/packages/calendar/ ./packages/calendar/ | ||
COPY --from=builder /build/node_modules/ ./node_modules | ||
COPY --from=builder /build/packages/calendar/ ./packages/calendar/ | ||
COPY matrix-meetings-bot/conf ./conf | ||
COPY matrix-meetings-bot/lib ./lib | ||
CMD ["node", "./lib/index.js"] |
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
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