karalabe / xgo

Go CGO cross compiler
MIT License
2.14k stars 280 forks source link

How to set go env `GOPROXY=https://goproxy.cn,direct` in the docker container? #197

Closed xuanjiang1985 closed 4 years ago

xuanjiang1985 commented 4 years ago
Checking for required docker image karalabe/xgo-latest... found.
Cross compiling server...
Building locally server...
Bootstrapping linux/arm-5...
go: github.com/gin-gonic/gin@v1.6.3: Get https://proxy.golang.org/github.com/gin-gonic/gin/@v/v1.6.3.mod: dial tcp 172.217.24.17:443: i/o timeout
2020/09/29 22:52:53 Failed to cross compile package: exit status 1.
yinhonglu commented 4 years ago

1、docker run -ti --name=xgo-build karalabe/xgo-latest /bin/sh 2、docker exec -ti xgo-build /bin/bash 3、go env -w GOPROXY=https://goproxy.cn,direct 4、docker ps -a, find xgo-build "CONTAINER ID" 5、docker commit -a “author” -m “message” “CONTAINER ID” karalabe/xgo-latest:v2 6、docker images, find karalabe/xgo-latest:v2 "IMAGE ID" 7、docker tag "IMAGE ID" karalabe/xgo-latest:latest