-
Notifications
You must be signed in to change notification settings - Fork 4
Docker image for resumectl 🐳 #2
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
base: main
Are you sure you want to change the base?
Conversation
Reviewer's GuideAdds Docker support for building and running resumectl, including a multi-stage Dockerfile, .dockerignore, and README updates documenting Docker build and usage commands. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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 - I've found 3 issues, and left some high level feedback:
- Consider aligning the Go base image version in the Dockerfile (e.g.,
golang:1.25-alpine3.23) with the version specified ingo.modso that container builds use the same toolchain as local builds. - Running
go mod tidyinside the Docker build can unexpectedly modify module files; you might want to rely on the existinggo.mod/go.sumand rungo mod downloadinstead to keep the image build purely consumptive. - The
.dockerignorefile is currently empty; adding common entries like.git,bin/,examples/, and other non-build artifacts will reduce image build context size and speed up builds.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider aligning the Go base image version in the Dockerfile (e.g., `golang:1.25-alpine3.23`) with the version specified in `go.mod` so that container builds use the same toolchain as local builds.
- Running `go mod tidy` inside the Docker build can unexpectedly modify module files; you might want to rely on the existing `go.mod`/`go.sum` and run `go mod download` instead to keep the image build purely consumptive.
- The `.dockerignore` file is currently empty; adding common entries like `.git`, `bin/`, `examples/`, and other non-build artifacts will reduce image build context size and speed up builds.
## Individual Comments
### Comment 1
<location> `Dockerfile:3` </location>
<code_context>
+
+# Build stage
+FROM golang:1.25-alpine3.23 AS builder
+WORKDIR /app
+
</code_context>
<issue_to_address>
**issue (bug_risk):** The Go base image tag `golang:1.25-alpine3.23` likely does not exist and will break builds.
Please switch to a Go base image tag that actually exists on Docker Hub (for example, `golang:1.22-alpine3.20`, or another published version that matches your requirements) and update it over time as needed.
</issue_to_address>
### Comment 2
<location> `Dockerfile:4-11` </location>
<code_context>
+WORKDIR /app
+
+RUN apk add --no-cache make
+COPY . .
+
+# Build the resumectl binary
</code_context>
<issue_to_address>
**suggestion (performance):** Copying the entire context before dependency resolution hurts build caching and can slow builds.
Copying the full source tree before dependency resolution means any app change invalidates the cache and reruns `go mod tidy` and module downloads. Instead, copy only `go.mod`/`go.sum`, download deps, then copy the rest:
```dockerfile
COPY go.mod go.sum ./
RUN go mod download
COPY . .
```
This keeps dependency caching stable and speeds up incremental builds.
```suggestion
WORKDIR /app
RUN apk add --no-cache make
# Copy go module files and download dependencies to leverage Docker build cache
COPY go.mod go.sum ./
RUN go mod download
# Now copy the rest of the source code
COPY . .
# Build the resumectl binary
RUN go mod tidy
RUN make build
```
</issue_to_address>
### Comment 3
<location> `Dockerfile:10` </location>
<code_context>
+COPY . .
+
+# Build the resumectl binary
+RUN go mod tidy
+RUN make build
+
</code_context>
<issue_to_address>
**suggestion:** `go mod tidy` in the build step may introduce non-reproducible builds by mutating go.mod/go.sum.
Because it mutates `go.mod`/`go.sum` during the image build, this step ties the image to whatever the module graph looks like at build time, which can lead to unexpected diffs and flaky CI when upstream dependencies change. For reproducible images, prefer `go mod download` (e.g. `go mod download all`) here and run `go mod tidy` in dev/CI outside the Docker build.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| @@ -0,0 +1,23 @@ | |||
|
|
|||
| # Build stage | |||
| FROM golang:1.25-alpine3.23 AS builder | |||
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.
issue (bug_risk): The Go base image tag golang:1.25-alpine3.23 likely does not exist and will break builds.
Please switch to a Go base image tag that actually exists on Docker Hub (for example, golang:1.22-alpine3.20, or another published version that matches your requirements) and update it over time as needed.
| WORKDIR /app | ||
|
|
||
| RUN apk add --no-cache make | ||
| COPY . . | ||
|
|
||
| # Build the resumectl binary | ||
| RUN go mod tidy | ||
| RUN make build |
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.
suggestion (performance): Copying the entire context before dependency resolution hurts build caching and can slow builds.
Copying the full source tree before dependency resolution means any app change invalidates the cache and reruns go mod tidy and module downloads. Instead, copy only go.mod/go.sum, download deps, then copy the rest:
COPY go.mod go.sum ./
RUN go mod download
COPY . .This keeps dependency caching stable and speeds up incremental builds.
| WORKDIR /app | |
| RUN apk add --no-cache make | |
| COPY . . | |
| # Build the resumectl binary | |
| RUN go mod tidy | |
| RUN make build | |
| WORKDIR /app | |
| RUN apk add --no-cache make | |
| # Copy go module files and download dependencies to leverage Docker build cache | |
| COPY go.mod go.sum ./ | |
| RUN go mod download | |
| # Now copy the rest of the source code | |
| COPY . . | |
| # Build the resumectl binary | |
| RUN go mod tidy | |
| RUN make build |
| COPY . . | ||
|
|
||
| # Build the resumectl binary | ||
| RUN go mod tidy |
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.
suggestion: go mod tidy in the build step may introduce non-reproducible builds by mutating go.mod/go.sum.
Because it mutates go.mod/go.sum during the image build, this step ties the image to whatever the module graph looks like at build time, which can lead to unexpected diffs and flaky CI when upstream dependencies change. For reproducible images, prefer go mod download (e.g. go mod download all) here and run go mod tidy in dev/CI outside the Docker build.
|
|
| make build | ||
|
|
||
| # Build resumectl Docker image | ||
| docker build -t yourname/resumectl . |
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.
Would it be possible to add a task to the Makefile to have something similar to make build?
Hello there ! First of all, congratulations for making that amazing tool 🙌
Summary :
I took the liberty to add a Dockerfile to build a Docker image for resumectl, and updated the README accordingly. I tried to keep it as light as possible, while keeping everything working well (especially PDF generation).
Additional idea :
It could be nice to add a simple Github Actions workflow to build an official image with each release, so people can simple use docker commands with
ghcr.io/juhnny5/resumectlinstead of having to build their own imageFeel free to edit what you want, or suggest me changes 😉
Summary by Sourcery
Add Docker support for building and running resumectl and document Docker usage.
New Features:
Enhancements:
Build: