-
Notifications
You must be signed in to change notification settings - Fork 280
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
docker: use Go version as defined in the package #187
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,11 +8,20 @@ RUN cross_debian_arch=$(uname -m | sed -e 's/aarch64/amd64/' -e 's/x86_64/arm64 | |
cross_pkg_arch=$(uname -m | sed -e 's/aarch64/x86-64/' -e 's/x86_64/aarch64/'); \ | ||
apt-get update -y && \ | ||
apt-get dist-upgrade -y && \ | ||
apt-get install -y wget make git clang-16 golang unzip \ | ||
apt-get install -y wget make git clang-16 unzip libc6-dev g++ gcc pkgconf \ | ||
gcc-${cross_pkg_arch}-linux-gnu libc6-${cross_debian_arch}-cross && \ | ||
apt-get clean autoclean && \ | ||
apt-get autoremove --yes | ||
|
||
COPY go.mod /tmp/go.mod | ||
# Extract Go version from go.mod | ||
RUN GO_VERSION=$(grep -oP 'go \K[0-9]+\.[0-9]+\.[0-9]+' /tmp/go.mod) && \ | ||
florianl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
wget -qO- https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xz | ||
# Set Go environment variables | ||
ENV GOPATH="/agent/go" | ||
ENV GOCACHE="/agent/.cache" | ||
ENV PATH="/usr/local/go/bin:$PATH" | ||
|
||
RUN wget -qO- https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \ | ||
| sh -s -- -b $(go env GOPATH)/bin v1.56.2 | ||
|
||
|
@@ -32,12 +41,7 @@ RUN | |
&& find "$INSTALL_DIR/include" -type f -exec chmod +r {} \; \ | ||
&& rm "$PB_FILE" | ||
|
||
# The docker image is built as root - make binaries available to user. | ||
RUN mv /root/go/bin/* /usr/local/bin/ | ||
|
||
ENV GOPATH=/agent/go | ||
ENV GOCACHE=/agent/.cache | ||
|
||
RUN echo "export PATH=\"\$PATH:\$(go env GOPATH)/bin\"" >> ~/.bashrc | ||
# Append to /etc/profile for login shells | ||
RUN echo 'export PATH="/usr/local/go/bin:$PATH"' >> /etc/profile | ||
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. In the debian docker in via the file
Appending |
||
|
||
ENTRYPOINT ["/bin/bash", "-l", "-c"] |
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.
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.
libc6-dev
,g++
,gcc+
andpkgconf
where installed previously by the packagegolang
and are required dependencies for cgo - see https://packages.debian.org/trixie/golang-1.23-goThere 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.
Still better do it explicitly to be independent of
golang
dependencies, which may change in the future. Explicitly naming the packages also serves as a documentation/reference. Also, it doesn't cost extra time when these packages are already installed.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.
Oh nevermind, misread your comment.