-
Notifications
You must be signed in to change notification settings - Fork 6
Docker workflow to build and push image #76
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| name: Docker Image CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| pull_request: | ||
| branches: [ "main" ] | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Log in to Docker Hub | ||
| if: github.event_name == 'push' | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
|
||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v6 | ||
|
Comment on lines
+14
to
+27
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major 🧩 Analysis chain🏁 Script executed: # First, locate and examine the workflow file
find . -name "docker-image.yml" -type fRepository: call-0f-code/COC-API Length of output: 195 🏁 Script executed: # Check the full content of the workflow file to understand context
cat -n .github/workflows/docker-image.ymlRepository: call-0f-code/COC-API Length of output: 1035 🏁 Script executed: # Verify the specific lines mentioned (14-24) and surrounding context
sed -n '1,30p' .github/workflows/docker-image.yml | cat -nRepository: call-0f-code/COC-API Length of output: 1035 Pin all GitHub Actions to commit SHAs and disable checkout credential persistence. All three actions (checkout, docker/login-action, and docker/build-push-action) use tag refs instead of immutable commit SHAs, creating supply-chain risk if tags are reassigned. Additionally, the checkout action omits Suggested hardening diff - name: Checkout repository
- uses: actions/checkout@v4
+ uses: actions/checkout@<FULL_LENGTH_COMMIT_SHA>
+ with:
+ persist-credentials: false
- name: Log in to Docker Hub
- uses: docker/login-action@v3
+ uses: docker/login-action@<FULL_LENGTH_COMMIT_SHA>
- name: Build and push Docker image
- uses: docker/build-push-action@v6
+ uses: docker/build-push-action@<FULL_LENGTH_COMMIT_SHA>Note: The Docker Hub login step runs on both push and pull_request events, but will fail on forked PRs due to unavailable secrets. Consider adding 🧰 Tools🪛 zizmor (1.26.1)[warning] 14-15: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [error] 15-15: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 18-18: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 24-24: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
| with: | ||
| context: . | ||
| file: ./Dockerfile | ||
| push: ${{ github.event_name == 'push' }} | ||
| tags: callofcode07/coc-api:latest | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.