chore: update golang images

* Remove unnecessary environment variables (GOROOT, GOPATH, GOBIN)
  since they have matching defaults
* Install the latest stable version of Go at image build time
This commit is contained in:
Jonathan Yu 2021-04-03 17:03:47 +00:00
parent 1638e83ffb
commit 4eb35b3a80
2 changed files with 14 additions and 20 deletions

View File

@ -3,16 +3,13 @@ FROM codercom/enterprise-base:centos
# Run everything as root
USER root
# Install go1.15
RUN curl -L "https://dl.google.com/go/go1.15.3.linux-amd64.tar.gz" | tar -C /usr/local -xzvf -
# Setup go env vars
ENV GOROOT /usr/local/go
ENV PATH $PATH:$GOROOT/bin
ENV GOPATH /home/coder/go
ENV GOBIN $GOPATH/bin
ENV PATH $PATH:$GOBIN
# Install latest stable version of Go
RUN GOVERSION="$(curl --silent --show-error --location https://golang.org/VERSION?m=text)" && \
curl --silent --show-error --location "https://golang.org/dl/${GOVERSION}.linux-amd64.tar.gz" | \
tar -C /usr/local -xzvf -
# Set back to coder user
USER coder
# Ensure Go binaries are available
ENV PATH $PATH:/usr/local/go/bin:/home/coder/go/bin

View File

@ -3,16 +3,13 @@ FROM codercom/enterprise-base:ubuntu
# Run everything as root
USER root
# Install go1.15
RUN curl -L "https://dl.google.com/go/go1.15.3.linux-amd64.tar.gz" | tar -C /usr/local -xzvf -
# Setup go env vars
ENV GOROOT /usr/local/go
ENV PATH $PATH:$GOROOT/bin
ENV GOPATH /home/coder/go
ENV GOBIN $GOPATH/bin
ENV PATH $PATH:$GOBIN
# Install latest stable version of Go
RUN GOVERSION="$(curl --silent --show-error --location https://golang.org/VERSION?m=text)" && \
curl --silent --show-error --location "https://golang.org/dl/${GOVERSION}.linux-amd64.tar.gz" | \
tar -C /usr/local -xzvf -
# Set back to coder user
USER coder
# Ensure Go binaries are available
ENV PATH $PATH:/usr/local/go/bin:/home/coder/go/bin