-
Notifications
You must be signed in to change notification settings - Fork 1
Create docker.yml #1860
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
Create docker.yml #1860
Conversation
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
|
Note Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported. |
Reviewer's GuideAdds a new GitHub Actions workflow to build, optionally push, and sign Docker images for the repository on pushes, tags, PRs, and a scheduled run, using Docker Buildx, GitHub Container Registry, and cosign. File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes and found some issues that need to be addressed.
- The
jobs.buildsection is misstructured (a step is defined beforeruns-on, andruns-on/permissionsappear at the wrong indentation level), so the workflow likely won't be parsed correctly by GitHub Actions—please align it with the standardjobs.<job_id>.runs-on->stepsstructure. - The early
docker buildstep uses placeholder values (path/to/Dockerfile,my-image-name) that are inconsistent with the later metadata-based tagging and image naming; consider either removing this standalone build or wiring it into the sameIMAGE_NAME/metadata scheme used by thebuild-push-action.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `jobs.build` section is misstructured (a step is defined before `runs-on`, and `runs-on`/`permissions` appear at the wrong indentation level), so the workflow likely won't be parsed correctly by GitHub Actions—please align it with the standard `jobs.<job_id>.runs-on` -> `steps` structure.
- The early `docker build` step uses placeholder values (`path/to/Dockerfile`, `my-image-name`) that are inconsistent with the later metadata-based tagging and image naming; consider either removing this standalone build or wiring it into the same `IMAGE_NAME`/metadata scheme used by the `build-push-action`.
## Individual Comments
### Comment 1
<location> `.github/workflows/docker.yml:26-30` </location>
<code_context>
+
+
+jobs:
+ build:
+ - name: Build the Docker image
+ run: docker build . --file path/to/Dockerfile --tag my-image-name:$(date +%s)
+
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
</code_context>
<issue_to_address>
**issue (bug_risk):** Job structure/indentation is invalid for a GitHub Actions workflow and will prevent the job from running.
`build` is defined as a mapping, but it directly contains a list item (`- name: Build the Docker image`) instead of a `steps:` block, and `runs-on` is incorrectly aligned at the same level as `build`. This makes the workflow invalid. It should be structured as:
- `jobs:`
- `build:`
- `runs-on: ubuntu-latest`
- `permissions: ...`
- `steps:`
- `- name: Build the Docker image`
Move the `- name: Build the Docker image` step under `steps:` (or remove it if redundant) and nest `runs-on`/`permissions` under `build` so GitHub accepts the workflow.
</issue_to_address>
### Comment 2
<location> `.github/workflows/docker.yml:76-78` </location>
<code_context>
+
+ # Build and push Docker image with Buildx (don't push on PR)
+ # https://github.com/docker/build-push-action
+ - name: Build and push Docker image
+ id: build-and-push
+ uses: docker/build-push-action@v5.0.0
+ with:
+ context: ./
</code_context>
<issue_to_address>
**🚨 suggestion (security):** The `docker/build-push-action` is referenced by a mutable tag instead of a pinned commit, which weakens supply-chain security.
Other third-party actions here are pinned to commit SHAs, but this one uses the `@v5.0.0` tag. To avoid unexpected behavior if the tag is retargeted and to align with GitHub’s security guidance, please pin `docker/build-push-action` to its specific commit SHA.
Suggested implementation:
```
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@COMMIT_SHA_FOR_V5_0_0 # v5.0.0
with:
```
To fully implement this securely:
1. Replace COMMIT_SHA_FOR_V5_0_0 with the exact commit SHA corresponding to docker/build-push-action v5.0.0 from the official repository: https://github.com/docker/build-push-action/releases.
2. Keep the inline comment # v5.0.0 so humans can still see which version is intended while the workflow is pinned to an immutable commit for supply-chain security.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Summary by Sourcery
Add a GitHub Actions workflow to build, publish, and sign Docker images for the project using GitHub Container Registry.
CI: