Fix Docker build failure by upgrading Go version to support toolchain directive#3
Fix Docker build failure by upgrading Go version to support toolchain directive#3
Conversation
|
@bio-boris 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
Co-authored-by: bio-boris <1258634+bio-boris@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a Docker build failure by upgrading the Go version from 1.15 to 1.23.6 to support the toolchain directive required by OpenMaxIO object browser v1.7.6.
- Replaced Debian package installation of Go 1.15 with manual installation of Go 1.23.6
- Added curl dependency for downloading the Go binary
- Updated PATH environment variable to include the new Go installation location
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| RUN apt-get update && apt-get install -y git make build-essential golang-go && rm -rf /var/lib/apt/lists/* | ||
| RUN apt-get update && apt-get install -y git make build-essential curl && rm -rf /var/lib/apt/lists/* | ||
| RUN curl -L https://go.dev/dl/go1.23.6.linux-amd64.tar.gz | tar -C /usr/local -xz |
There was a problem hiding this comment.
Downloading and extracting files from the internet without checksum verification poses a security risk. Consider verifying the SHA256 checksum of the downloaded Go binary to ensure integrity and authenticity.
| RUN curl -L https://go.dev/dl/go1.23.6.linux-amd64.tar.gz | tar -C /usr/local -xz | |
| RUN curl -L -o go1.23.6.linux-amd64.tar.gz https://go.dev/dl/go1.23.6.linux-amd64.tar.gz && \ | |
| curl -L -o go1.23.6.linux-amd64.tar.gz.sha256 https://go.dev/dl/go1.23.6.linux-amd64.tar.gz.sha256 && \ | |
| sha256sum -c go1.23.6.linux-amd64.tar.gz.sha256 && \ | |
| tar -C /usr/local -xz -f go1.23.6.linux-amd64.tar.gz && \ | |
| rm go1.23.6.linux-amd64.tar.gz go1.23.6.linux-amd64.tar.gz.sha256 |
|
|
||
| RUN apt-get update && apt-get install -y git make build-essential golang-go && rm -rf /var/lib/apt/lists/* | ||
| RUN apt-get update && apt-get install -y git make build-essential curl && rm -rf /var/lib/apt/lists/* | ||
| RUN curl -L https://go.dev/dl/go1.23.6.linux-amd64.tar.gz | tar -C /usr/local -xz |
There was a problem hiding this comment.
The Go version 1.23.6 is hardcoded in the URL. Consider using a build argument or environment variable to make the Go version configurable and easier to update in the future.
| RUN curl -L https://go.dev/dl/go1.23.6.linux-amd64.tar.gz | tar -C /usr/local -xz | |
| ARG GO_VERSION=1.23.6 | |
| RUN curl -L https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xz |
The Docker build was failing with the error:
This occurred because the Dockerfile was installing Go 1.15 from Debian Bullseye packages, but the OpenMaxIO object browser project (v1.7.6) requires Go 1.23 with the
toolchain go1.23.6directive in itsgo.modfile. Thetoolchaindirective was introduced in Go 1.21, making Go 1.15 incompatible.Changes Made
golang-go) with manual installation of Go 1.23.6curlto the package installation list to download the Go binaryPATHenvironment variable to include the Go binary locationThe fix is minimal and surgical, addressing only the Go version compatibility issue without modifying any application logic or other dependencies.
Fixes #2.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.