基于alpine镜像制作go和goimports的Docker镜像
基于alpine制作go docker镜像
-
下载go源码包 For Linux
-
解压压缩包至当前文件夹
-
编辑Dockerfile
FROM csighub.tencentyun.com/pulse-line/alpine
COPY go /usr/local/go
ENV PATH=$PATH:/usr/local/go/bin:/root/go/bin \
GOROOT=/usr/local/go
WORKDIR /usr/local/test/
RUN ["go", "install", "golang.org/x/tools/cmd/goimports@latest"]
- 制作Docker镜像
docker build -t alpine-go-goimports:v0.0.1 .
- 运行容器
docker run -it alpine-go-goimports:v0.0.1