Ubuntu配置golang gin的环境以及相应的Dockerfile

apt-get update -y
apt-get install -y wget 
wget https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.12.5.linux-amd64.tar.gz 
export PATH=$PATH:/usr/local/go/bin
apt-get install -y vim
apt-get install -y git
apt-get install -y curl
export GOPATH=/root/go 
mkdir -p $GOPATH/src/golang.org/x/
cd $GOPATH/src/golang.org/x/
git clone https://github.com/golang/sys.git
git clone https://github.com/golang/text.git
git clone https://github.com/golang/crypto.git
git clone https://github.com/golang/net.git

mkdir -p $GOPATH/src/github.com/gin-gonic/
cd $GOPATH/src/github.com/gin-gonic/
git clone https://github.com/gin-gonic/gin.git
go get -u github.com/gin-gonic/gin

Dockerfile

FROM ubuntu:16.04
RUN apt-get update -y
RUN apt-get install -y wget 
RUN wget https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz
RUN tar -C /usr/local -xzf go1.12.5.linux-amd64.tar.gz 
ENV PATH $PATH:/usr/local/go/bin
RUN apt-get install -y vim
RUN apt-get install -y git
RUN apt-get install -y curl
ENV GOPATH /app
RUN mkdir -p $GOPATH/src/golang.org/x/
WORKDIR $GOPATH/src/golang.org/x
RUN git clone https://github.com/golang/sys.git
RUN git clone https://github.com/golang/text.git
RUN git clone https://github.com/golang/crypto.git
RUN git clone https://github.com/golang/net.git
RUN mkdir -p $GOPATH/src/github.com/gin-gonic/
WORKDIR $GOPATH/src/github.com/gin-gonic/
RUN git clone https://github.com/gin-gonic/gin.git
WORKDIR $GOPATH
RUN go get -u github.com/gin-gonic/gin

你可能感兴趣的:(杂谈)