I download and install Go
programming language like this:
curl -OL https://golang.org/dl/go1.17.3.linux-amd64.tar.gz
tar -C /usr/local -xvf go1.17.3.linux-amd64.tar.gz
touch /etc/profile.d/go.sh
echo "export PATH=$PATH:/usr/local/go/bin" >> /etc/profile.d/go.sh
source /etc/profile.d/go.sh
And it works. But I want to create a Docker
image containing Go and ready to use. So I did like this in Dockerfile
:
RUN curl -OL https://golang.org/dl/go1.17.3.linux-amd64.tar.gz
RUN tar -C /usr/local -xvf go1.17.3.linux-amd64.tar.gz
RUN touch /etc/profile.d/go.sh
RUN echo "export PATH=$PATH:/usr/local/go/bin" >> /etc/profile.d/go.sh
RUN source /etc/profile.d/go.sh
But it gives me error:
> [25/25] RUN source /etc/profile.d/go.sh:
#28 0.737 /bin/sh: 1: source: not found
How I have to do this? Im using ubuntu 20.04
as a base Docker image