Skip to content

Commit bc5a43e

Browse files
author
mujing
committed
build: update Dockerfile with latest Go tools versions
1 parent ea8e42f commit bc5a43e

1 file changed

Lines changed: 13 additions & 18 deletions

File tree

Dockerfile

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ RUN ARCH=$(dpkg --print-architecture) \
6161
&& go version
6262

6363
# Install Go tools to /opt/go-tools (not affected by volume mounts on /home/coder)
64-
RUN install -d -o coder -g coder /opt/go-tools \
65-
&& sudo -u coder env GOPATH=/opt/go-tools GOPROXY=${GOPROXY} /usr/local/go/bin/go install golang.org/x/tools/gopls@latest \
66-
&& sudo -u coder env GOPATH=/opt/go-tools GOPROXY=${GOPROXY} /usr/local/go/bin/go install github.com/go-delve/delve/cmd/dlv@latest \
67-
&& sudo -u coder env GOPATH=/opt/go-tools GOPROXY=${GOPROXY} /usr/local/go/bin/go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest \
68-
&& sudo -u coder env GOPATH=/opt/go-tools GOPROXY=${GOPROXY} /usr/local/go/bin/go install golang.org/x/tools/cmd/goimports@latest
64+
RUN mkdir -p /opt/go-tools \
65+
&& GOPATH=/opt/go-tools GOPROXY=${GOPROXY} /usr/local/go/bin/go install golang.org/x/tools/gopls@latest \
66+
&& GOPATH=/opt/go-tools GOPROXY=${GOPROXY} /usr/local/go/bin/go install github.com/go-delve/delve/cmd/dlv@latest \
67+
&& GOPATH=/opt/go-tools GOPROXY=${GOPROXY} /usr/local/go/bin/go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest \
68+
&& GOPATH=/opt/go-tools GOPROXY=${GOPROXY} /usr/local/go/bin/go install golang.org/x/tools/cmd/goimports@latest
6969

7070
# Create symlinks for go commands (ensures availability even when PATH is reset)
7171
RUN ln -s /usr/local/go/bin/go /usr/local/bin/go \
@@ -79,18 +79,17 @@ RUN ARCH=$(dpkg --print-architecture) && \
7979
if [ "$ARCH" = "amd64" ]; then CONDA_ARCH="x86_64"; \
8080
elif [ "$ARCH" = "arm64" ]; then CONDA_ARCH="aarch64"; \
8181
else CONDA_ARCH="$ARCH"; fi && \
82-
rm -rf /tmp/conda /opt/conda \
82+
rm -rf /opt/conda \
8383
&& curl -fsSL https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-${CONDA_ARCH}.sh -o /tmp/miniforge.sh \
8484
&& chmod +x /tmp/miniforge.sh \
85-
&& sudo -u coder bash /tmp/miniforge.sh -b -p /tmp/conda \
86-
&& mv /tmp/conda /opt/conda \
85+
&& bash /tmp/miniforge.sh -b -p /opt/conda \
8786
&& rm /tmp/miniforge.sh
8887
ENV PATH=/opt/conda/bin:$PATH
8988

9089
# Install Python 3.13 via conda-forge and create symlinks
91-
RUN sudo -u coder /opt/conda/bin/conda install -y python=3.13 \
92-
&& sudo -u coder /opt/conda/bin/conda config --set show_channel_urls yes \
93-
&& sudo -u coder /opt/conda/bin/conda clean -afy \
90+
RUN /opt/conda/bin/conda install -y python=3.13 \
91+
&& /opt/conda/bin/conda config --set show_channel_urls yes \
92+
&& /opt/conda/bin/conda clean -afy \
9493
&& ln -sf /opt/conda/bin/python /usr/bin/python3 \
9594
&& ln -sf /opt/conda/bin/python /usr/bin/python \
9695
&& ln -sf /opt/conda/bin/pip /usr/bin/pip3 \
@@ -160,19 +159,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
160159

161160
# Install rbenv and ruby-build to /opt/rbenv (system path, not affected by volume mounts)
162161
RUN git clone --depth 1 https://github.com/rbenv/rbenv.git /opt/rbenv \
163-
&& git clone --depth 1 https://github.com/rbenv/ruby-build.git /opt/rbenv/plugins/ruby-build \
164-
&& chown -R coder:coder /opt/rbenv
162+
&& git clone --depth 1 https://github.com/rbenv/ruby-build.git /opt/rbenv/plugins/ruby-build
165163

166164
# Install latest stable Ruby and Rails
167-
RUN sudo -u coder env RUBY_VERSION=${RUBY_VERSION} bash -lc 'set -euo pipefail \
168-
&& export RBENV_ROOT=/opt/rbenv \
169-
&& export PATH="$RBENV_ROOT/bin:$RBENV_ROOT/shims:$PATH" \
170-
&& /opt/rbenv/plugins/ruby-build/install.sh \
165+
RUN /opt/rbenv/plugins/ruby-build/install.sh \
171166
&& rbenv install "$RUBY_VERSION" \
172167
&& rbenv global "$RUBY_VERSION" \
173168
&& rbenv rehash \
174169
&& gem install bundler rails --no-document \
175-
&& rbenv rehash'
170+
&& rbenv rehash
176171

177172
# Configure gem mirror
178173
RUN echo "---\n:sources:\n - https://gems.ruby-china.com/" > /home/coder/.gemrc

0 commit comments

Comments
 (0)