-
Notifications
You must be signed in to change notification settings - Fork 9
Updated PHP, Swoole, Imagemagick, Add more CI scanning, ... #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 19 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
1024731
ADD pr-scan.yml pipeline, UPDATE PHP to 8.5.3. UPDATE .gitignore, REA…
davidjeddy 418bfe0
FIX Trivy scanning step name
davidjeddy d6fe48d
REVERT PHP to 8.4.18 due to build failure
davidjeddy 955d067
UPDATED aquasecurity/trivy-action to 0.35.0
davidjeddy e7c0e31
Version bumped PHP/Swoole in container image
davidjeddy fa5df86
CI trigger
davidjeddy eb89709
Running pr-scan CI on any push. Every commit should be built, even if…
davidjeddy a2e5fd8
T/Sing build issue of not finding zstd so
davidjeddy 1a804b0
Updated pipeline action versions
davidjeddy 5b993d0
Build passing tests now
davidjeddy bb9281b
ADD image push for feature branch builds
davidjeddy 258e983
Remove docker-buildx for now, we do not use ARM hosts
davidjeddy adc52e8
REMOVE multi-arch builds in exchange for faster build and releases
davidjeddy b0bc807
Refactory ARM build process to avoid cross-arch building
davidjeddy e5134a2
Trying to fix multi-arch builds
davidjeddy 7141e77
ADD dive test tool. ADD image lifecycle GH action. Dockerfile now bas…
davidjeddy 9ff192d
Working on getting Trivy report into Security Tab
davidjeddy 11abdac
FIX scheduled trivy GH action
davidjeddy 36c11ed
FIX spelling
davidjeddy 434dbb2
Changes from feedback
davidjeddy b7bc9f0
Feedback improvements
davidjeddy 60392ba
Feedback corrections
davidjeddy 2693847
Feedback corrections
davidjeddy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| rules: | ||
| # If the efficiency is measured below X%, mark as failed. | ||
| # Expressed as a ratio between 0-1. | ||
| lowestEfficiency: 0.90 | ||
|
|
||
| # If the amount of wasted space is at least X or larger than X, mark as failed. | ||
| # Expressed in B, KB, MB, and GB. | ||
| highestWastedBytes: 128MB | ||
|
|
||
| # If the amount of wasted space makes up for X% or more of the image, mark as failed. | ||
| # Note: the base image layer is NOT included in the total image size. | ||
| # Expressed as a ratio between 0-1; fails if the threshold is met or crossed. | ||
| highestUserWastedPercent: 0.10 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| .git* | ||
| *.md | ||
| *test*.* | ||
| Dockerfile | ||
| LICENSE | ||
| trivy-*.json |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,86 @@ | ||
| name: Build and Push to DockerHub | ||
| name: Build and Push | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| on: push | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| REGISTRY: docker.io | ||
| IMAGE_NAME: appwrite/base | ||
| TAG: ${{ github.event.release.tag_name }} | ||
| REGISTRY: docker.io | ||
|
|
||
| # https://github.blog/changelog/2025-01-16-linux-arm64-hosted-runners-now-available-for-free-in-public-repositories-public-preview/ | ||
| # https://learn.arm.com/learning-paths/cross-platform/github-arm-runners/actions/ | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| build_and_push: | ||
| if: github.ref != 'refs/heads/main' | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-24.04 | ||
| arch: amd64 | ||
| - os: ubuntu-24.04-arm | ||
| arch: arm64 | ||
| steps: | ||
| - name: Checkout the repo | ||
| uses: actions/checkout@v3 | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Login to DockerHub | ||
| uses: docker/login-action@v4 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| - name: Build an image from Dockerfile | ||
| run: | | ||
| docker image build --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-${{matrix.arch}} . | ||
|
|
||
| - name: Push an image | ||
| run: | | ||
| docker image push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-${{matrix.arch}} | ||
|
|
||
| manifest_build_and_push_on_feature: | ||
| if: github.ref != 'refs/heads/main' | ||
| needs: build_and_push | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Login to DockerHub | ||
| uses: docker/login-action@v2 | ||
| uses: docker/login-action@v4 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v2 | ||
| - name: Create manifest | ||
| run: | | ||
| docker manifest create \ | ||
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \ | ||
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-amd64 \ | ||
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-arm64 | ||
|
|
||
| - name: Push manifest | ||
| run: | | ||
| docker manifest push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
|
|
||
| - name: Build and push | ||
| uses: docker/build-push-action@v4 | ||
| manifest_build_and_push_on_main: | ||
| if: github.ref == 'refs/heads/main' | ||
| needs: build_and_push | ||
davidjeddy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Login to DockerHub | ||
| uses: docker/login-action@v4 | ||
| with: | ||
| context: . | ||
| platforms: linux/amd64,linux/arm64 | ||
| push: true | ||
| tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| - name: Create manifest | ||
| run: | | ||
| docker manifest create \ | ||
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }} \ | ||
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-amd64 \ | ||
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-arm64 | ||
|
|
||
| - name: Push manifest | ||
| run: | | ||
| docker manifest push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }} | ||
davidjeddy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: Dive Test | ||
|
|
||
| on: push | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| IMAGE_NAME: appwrite/base | ||
| REGISTRY: docker.io | ||
|
|
||
| jobs: | ||
| dive: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6.0.2 | ||
|
|
||
| - name: Build an image from Dockerfile | ||
| run: | | ||
| docker image build --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} . | ||
|
|
||
| - name: Dive | ||
| uses: yuichielectric/dive-action@0.0.4 | ||
| with: | ||
| image: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}' | ||
davidjeddy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
davidjeddy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # https://github.com/marketplace/actions/delete-package-versions | ||
| # Ignore SemVer tags (proper releases) | ||
| # Keep 7 sha tagged images (ordred by publish datetime) | ||
|
|
||
| name: Container Lifecycle Policy | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '30 9 * * *' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| IMAGE_NAME: appwrite/base | ||
| REGISTRY: docker.io | ||
|
|
||
| jobs: | ||
| prune_sha_tagged_images: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Login to DockerHub | ||
| uses: docker/login-action@v4 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| # TODO pull all the images in the registry before running this. Be sure we have a backup | ||
| # # https://github.com/marketplace/actions/delete-package-versions#delete-oldest-x-number-of-versions-while-ignoring-particular-package-versions | ||
| # # Ignore SemVer tagged images https://ihateregex.io/expr/semver/ | ||
| # - uses: actions/delete-package-versions@v5 | ||
| # with: | ||
| # ignore-versions: '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' | ||
| # min-versions-to-keep: 7 | ||
| # package-name: 'base' | ||
| # package-type: 'container' |
davidjeddy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: Scheduled Trivy Scan | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| pull_request: | ||
| # The branches below must be a subset of the branches above | ||
| branches: [ "main" ] | ||
| schedule: | ||
| - cron: '43 11 * * 6' | ||
|
|
||
| permissions: | ||
| contents: read # for actions/checkout to fetch code | ||
| security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | ||
| actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status | ||
|
|
||
| env: | ||
| IMAGE_NAME: appwrite/base | ||
| REGISTRY: docker.io | ||
|
|
||
| jobs: | ||
| scheduled_trivy: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6.0.2 | ||
|
|
||
| - name: Build an image from Dockerfile | ||
| run: | | ||
| docker image build --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} . | ||
|
|
||
| - name: Run Trivy vulnerability scanner (sarif report) | ||
| uses: aquasecurity/trivy-action@0.35.0 | ||
| with: | ||
| format: 'sarif' | ||
| image-ref: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}' | ||
| output: 'trivy-image-results.sarif' | ||
| severity: 'CRITICAL,HIGH' | ||
|
|
||
| # https://github.com/github/codeql-action/blob/main/upload-sarif/action.yml | ||
| - name: Upload Trivy scan results | ||
| uses: github/codeql-action/upload-sarif@v4 | ||
| with: | ||
| sarif_file: '.' |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # https://github.com/marketplace/actions/container-structure-test-action | ||
| name: Container Structure Test | ||
|
|
||
| on: push | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| IMAGE_NAME: appwrite/base | ||
| REGISTRY: docker.io | ||
|
|
||
| jobs: | ||
| structure_test: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout the repo | ||
| uses: actions/checkout@v6.0.2 | ||
|
|
||
| - name: Build an image from Dockerfile | ||
| run: | | ||
| docker image build --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} . | ||
|
|
||
| - name: Run container structure tests | ||
| uses: plexsystems/container-structure-test-action@v0.1.0 | ||
| with: | ||
| image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} | ||
| config: tests.yaml |
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,48 +1,38 @@ | ||
| # This workflow uses actions that are not certified by GitHub. | ||
| # They are provided by a third-party and are governed by | ||
| # separate terms of service, privacy policy, and support | ||
| # documentation. | ||
| # https://github.com/aquasecurity/trivy-action | ||
| name: Push Trivy Scan | ||
|
|
||
| name: trivy | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| pull_request: | ||
| # The branches below must be a subset of the branches above | ||
| branches: [ "main" ] | ||
| schedule: | ||
| - cron: '43 11 * * 6' | ||
| on: push | ||
|
|
||
| permissions: | ||
| contents: read | ||
| contents: read # for actions/checkout to fetch code | ||
| security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | ||
| actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status | ||
|
|
||
| env: | ||
| IMAGE_NAME: appwrite/base | ||
| REGISTRY: docker.io | ||
|
|
||
| jobs: | ||
| build: | ||
| permissions: | ||
| contents: read # for actions/checkout to fetch code | ||
| security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | ||
| actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| trivy: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| uses: actions/checkout@v6.0.2 | ||
davidjeddy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Build an image from Dockerfile | ||
| run: | | ||
| docker build -t appwrite/docker-base:${{ github.sha }} . | ||
| docker image build --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} . | ||
|
|
||
| - name: Run Trivy vulnerability scanner | ||
| uses: aquasecurity/trivy-action@7b7aa264d83dc58691451798b4d117d53d21edfe | ||
| - name: Run Trivy vulnerability scanner (sarif report) | ||
| uses: aquasecurity/trivy-action@0.35.0 | ||
| with: | ||
| image-ref: 'appwrite/docker-base:${{ github.sha }}' | ||
| format: 'template' | ||
| template: '@/contrib/sarif.tpl' | ||
| output: 'trivy-results.sarif' | ||
| format: 'sarif' | ||
| image-ref: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}' | ||
| output: 'trivy-image-results.sarif' | ||
| severity: 'CRITICAL,HIGH' | ||
|
|
||
| - name: Upload Trivy scan results to GitHub Security tab | ||
| uses: github/codeql-action/upload-sarif@v3 | ||
| # https://github.com/github/codeql-action/blob/main/upload-sarif/action.yml | ||
| - name: Upload Trivy scan results | ||
| uses: github/codeql-action/upload-sarif@v4 | ||
| with: | ||
| sarif_file: 'trivy-results.sarif' | ||
| sarif_file: '.' | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,4 @@ | ||
| .idea | ||
| *.log | ||
| NOTES*.md | ||
| trivy-*-results.json |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.