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.
Optimized Dockerfile: This pull request refines the Dockerfile used to build the linktoqr application. It focuses on reducing the image size by leveraging multi-stage builds and improving build efficiency.
Multi-Stage Build: The Dockerfile now has a cleaner separation between the build and runtime environments. Only the compiled binary (linktoqr) is copied to the final image, eliminating unnecessary build dependencies and source code.
Base Image Change: The base image has been switched from alpine:latest to alpine:3.15, a more minimal version that reduces the final image size further.
Efficient Dependency Management: Only the go.mod and go.sum files are copied initially to optimize the Go module dependency download process, followed by the application source code.
GOOS Conflict Resolution: The Dockerfile now resolves the GOOS conflict that caused the "Exec Format Error." By explicitly setting the GOARCH to amd64 in the build stage, we ensure the compiled binary matches the architecture of the target machine, preventing the execution issue. This modification addresses the architecture mismatch that was previously causing errors.
Issue ID: This change addresses the issue of large Docker image sizes, inefficiencies in the build process, and the GOOS conflict causing the "Exec Format Error" (related to issue GOOS Conflict in Dockerfile Causes Exec Format Error #18).