-
Notifications
You must be signed in to change notification settings - Fork 0
Update docker-compose.yml #14
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
Closed
Closed
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
6920dad
Update docker-compose.yml
FinnPL 544e35e
Update docker-compose-scan.yml
FinnPL ea3e1b2
Update docker-compose-scan.yml
FinnPL 06192f4
Update docker-compose-scan.yml
FinnPL 9cf676f
Update docker-compose-scan.yml
FinnPL ef66154
Update docker-compose-scan.yml
FinnPL 7bf805b
Update docker-compose-scan.yml
FinnPL 799f529
Update docker-compose-scan.yml
FinnPL d3e376d
Update docker-compose-scan.yml
FinnPL d87c2b3
Update docker-compose-scan.yml
FinnPL 8d16fed
Update docker-compose-scan.yml
FinnPL 7ebb1b2
Rename docker-compose-scan.yml to docker-scan.yml
FinnPL 02a5886
Update docker-scan.yml
FinnPL c8fc15c
Update docker-scan.yml
FinnPL 89ea9a7
Update docker-scan.yml
FinnPL b233e0a
Update docker-scan.yml
FinnPL 380880e
Update docker-scan.yml
FinnPL 5ebbe9e
Update docker-compose.yml
FinnPL c333b64
Update docker-scan.yml
FinnPL 8cd0ca7
Update docker-scan.yml
FinnPL 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 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 |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| name: Docker Scout Scan | ||
| on: | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| find-images: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Install jq and yq | ||
| run: | | ||
| sudo apt-get update && sudo apt-get install -y jq | ||
| # Install yq (v4) if not already installed | ||
| if ! command -v yq &>/dev/null; then | ||
| wget https://github.com/mikefarah/yq/releases/download/v4.25.1/yq_linux_amd64 -O /usr/local/bin/yq | ||
| chmod +x /usr/local/bin/yq | ||
| fi | ||
|
|
||
| - name: Find images in Docker Compose files and set matrix | ||
| id: set-matrix | ||
| run: | | ||
| echo "Searching for docker-compose files..." | ||
| # Find docker-compose.yml and docker-compose-*.yml files in all subdirectories. | ||
| files=$(find . -type f \( -iname "docker-compose.yml" -o -iname "docker-compose-*.yml" \)) | ||
| echo "Found files:" | ||
| echo "$files" | ||
| images=() | ||
| for file in $files; do | ||
| echo "Processing $file" | ||
| # Use yq with the optional operator to extract the image field | ||
| while IFS= read -r image; do | ||
| if [[ -n "$image" ]]; then | ||
| images+=("$image") | ||
| fi | ||
| done < <(yq e '.services[].image?' "$file") | ||
| done | ||
| # If no images found, set matrix to an empty JSON array. | ||
| if [ ${#images[@]} -eq 0 ]; then | ||
| echo "No images found, setting matrix to []" | ||
| matrix="[]" | ||
| else | ||
| # Remove duplicates and convert to a JSON array. | ||
| unique_images=($(printf "%s\n" "${images[@]}" | sort -u)) | ||
| matrix=$(printf '%s\n' "${unique_images[@]}" | jq -R . | jq -s .) | ||
| fi | ||
| echo "Matrix JSON: $matrix" | ||
| # Set the output using multiline syntax. | ||
| echo "matrix<<EOF" >> $GITHUB_OUTPUT | ||
| echo "$matrix" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
|
|
||
| scan-images: | ||
| needs: find-images | ||
| runs-on: ubuntu-latest | ||
| environment: PR | ||
| strategy: | ||
| matrix: | ||
| image: ${{ fromJson(needs.find-images.outputs.matrix) }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
|
||
| - name: Scan image with Docker Scout | ||
| id: scout | ||
| uses: docker/scout-action@v1 | ||
|
||
| with: | ||
| command: recommendations | ||
| image: ${{ matrix.image }} | ||
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
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.
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium