Skip to content

Commit

Permalink
docker: workers: Install an older Golang toolchain as an alternative
Browse files Browse the repository at this point in the history
Projects suggesting go toolchain <1.21 compiled with 1.21+ may actually
get their version bumped by the new Go toolchain automatically which
creates an undesirable side effect of dirtying the source tree. To
prevent that, pre-install an older Go toolchain (1.20) as well and let
it handle such scenarios, using 1.21 only really for projects requiring
1.21+.

Signed-off-by: Erik Skultety <[email protected]>
  • Loading branch information
eskultety committed Feb 13, 2024
1 parent 0efe972 commit b44cf62
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docker/Dockerfile-workers
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ RUN python3.11 -m venv venv && \
venv/bin/pip install . --no-deps --no-cache-dir && \
rm -rf .git

# Install an older version of Go fixed at 1.20 (along with the base >=1.21):
# - install Go's official shim
# - let the shim download the actual Go SDK (the download forces the output parent dir to $HOME)
# - move the SDK to a host local install system-wide location
# - remove the shim as it forces and expects the SDK to be used from $HOME
# - clean any build artifacts Go creates as part of the process.
RUN go install 'golang.org/dl/go1.20@latest' && \
"$HOME/go/bin/go1.20" download && \
mkdir /usr/local/go && \
mv "$HOME/sdk/go1.20" /usr/local/go && \
rm -rf "$HOME/go" "$HOME/.cache/go-build/"

# Use the system CA bundle for the requests library
ENV REQUESTS_CA_BUNDLE=/etc/pki/ca-trust/extracted/pem/directory-hash/ca-bundle.crt
# Use the system CA bundle for native SSL calls from celery (python)
Expand Down

0 comments on commit b44cf62

Please sign in to comment.