
multiarch/goxc!logo
docker-goxc是goxc工具的Docker镜像封装,goxc是一款Go语言构建工具,专注于跨平台编译、应用打包及部署流程。该镜像提供了便捷的跨编译环境,无需在本地配置复杂的Go交叉编译工具链,即可为多种操作系统和架构构建Go应用。
通过以下命令可快速查看goxc工具的帮助信息:
console$ docker run -it --rm multiarch/goxc goxc -h goxc version: 0.17.1 build date: Usage: goxc [<option(s)>] [<task(s)>] Help Options: -h <topic> 帮助 - 默认主题为'options'。也可指定'tasks'或任何任务/别名名称 -ht 帮助 - 显示任务(及任务别名) -version 打印版本信息 -v 详细输出 Help Topics: options 默认) tasks 列出所有任务和别名 <task-name> 任务描述、任务选项和默认值 <alias-name> 列出别名对应的任务 Tasks options: -+tasks= 首先运行的额外任务。参见'-help tasks'获取任务列表 -t 构建交叉编译器工具链。等同于-tasks=toolchain -tasks+= 最后运行的额外任务。参见'-help tasks'获取任务列表 -tasks-= 排除的任务。参见'-help tasks'获取任务列表 Platform filtering: -arch= 指定架构(默认所有架构 - "386 amd64 arm") -bc= 指定构建约束(例如'linux,arm windows') -os= 指定操作系统(默认所有操作系统 - "linux darwin windows freebsd openbsd solaris dragonfly") Config files: -c= 配置名称 -wc (覆)写配置。覆写为累加式。尝试使用goxc -wc生成初始配置 Package versioning: -br= 分支名称(用于fork的仓库) -bu= 构建名称(用于预发布构建) -pr= 预发布信息(通常为'alpha'、'snapshot'等) -pv= 包版本(通常为[major].[minor].[patch],默认'snapshot') Build: -build-ccflags= 构建标志'print-commands' -build-compiler= 构建标志'compiler' -build-gccgoflags= 构建标志 -build-gcflags= 构建标志 -build-installsuffix= 构建标志 -build-ldflags= 构建标志 -build-print-commands= 构建标志'print-commands' -build-processors= 构建时使用的处理器数量 -build-race= 构建标志'race' -build-tags= 构建标志 -build-verbose= 构建标志'verbose' Other options: -codesign= 用于签名darwin二进制文件的身份(仅在主机OS为'darwin'时应用) -d= 目标根目录(默认$GOBIN/(appname)-xc) -env= 使用环境变量 -goroot= 指定Go根目录(当存在多个Go安装时有用) -include= 归档中包含的资源(默认=INSTALL*,README*,LICENSE*) -main-dirs-exclude= 从'main'包中排除的逗号分隔目录(默认=Godeps,testdata,_project,vendor) -max-processors= 最大处理器数量(用于并行任务) -n= 应用名称。默认是目录名称 -o= 编译输出文件名(字符串模板,默认-o="{{.Dest}}{{.PS}}{{.Version}}{{.PS}}{{.Os}}_{{.Arch}}{{.PS}}{{.ExeName}}{{.Ext}}") -pi= 已弃用的选项名称。使用-pr代替 -q= 安静模式(仅输出错误) -resources-exclude= 归档中排除的资源(默认=*.go) -resources-include= 归档中包含的资源(默认=INSTALL*,README*,LICENSE*) -wd= 指定工作目录 -wlc= 写入'local'配置
-h <topic>: 查看帮助信息,默认主题为options,可指定tasks或具体任务/别名名称-ht: 显示所有任务及别名-version: 打印版本信息-v: 详细输出模式-+tasks=: 首先运行的额外任务,需从任务列表中选择-t: 构建交叉编译器工具链,等同于-tasks=toolchain-tasks+=: 最后运行的额外任务,需从任务列表中选择-tasks-=: 排除的任务,需从任务列表中选择-arch=: 指定目标架构,默认支持"386 amd64 arm"-bc=: 指定构建约束,例如'linux,arm windows'-os=: 指定目标操作系统,默认支持"linux darwin windows freebsd openbsd solaris dragonfly"-c=: 配置名称-wc: (覆)写配置,覆写为累加式,可用于生成初始配置-br=: 分支名称(用于fork的仓库)-bu=: 构建名称(用于预发布构建)-pr=: 预发布信息(如'alpha'、'snapshot')-pv=: 包版本,默认'snapshot'-build-ccflags=: 构建标志'print-commands'-build-compiler=: 构建标志'compiler'-build-gccgoflags=: Go编译器标志-build-gcflags=: Go编译器标志-build-installsuffix=: 构建标志-build-ldflags=: 链接器标志-build-print-commands=: 构建标志'print-commands'-build-processors=: 构建时使用的处理器数量-build-race=: 构建标志'race'(启用数据竞争检测)-build-tags=: 构建标签-build-verbose=: 构建标志'verbose'(详细构建输出)-d=: 目标根目录,默认$GOBIN/(appname)-xc-env=: 设置环境变量-goroot=: 指定Go根目录-include=: 归档中包含的资源文件,默认"INSTALL*,README*,LICENSE*"-n=: 应用名称,默认使用目录名称-o=: 输出文件名模板-q=: 安静模式,仅输出错误信息-wd=: 指定工作目录从本地构建scaleway-cli项目,生成多平台可执行文件及归档包:
console$ docker run -it --rm -v $(pwd):/go/src/github.com/scaleway/scaleway-cli -w /go/src/github.com/scaleway/scaleway-cli multiarch/goxc goxc -env=GO15VENDOREXPERIMENT=1 Adding GO15VENDOREXPERIMENT=1 [goxc:go-install] 2016/01/11 10:31:27 Task go-install succeeded [goxc:xc] 2016/01/11 10:31:27 Parallelizing xc for 13 platforms, using max 7 of 8 processors [goxc:xc] 2016/01/11 10:32:17 Task xc succeeded [goxc:codesign] 2016/01/11 10:32:17 Task codesign succeeded [goxc:copy-resources] 2016/01/11 10:32:17 Task copy-resources succeeded [goxc:archive-zip] 2016/01/11 10:32:18 Artifact(s) archived to /go/src/github.com/scaleway/scaleway-cli/dist/1.7.0-rc1/scw_1.7.0-rc1_windows_386.zip [goxc:archive-zip] 2016/01/11 10:32:18 Artifact(s) archived to /go/src/github.com/scaleway/scaleway-cli/dist/1.7.0-rc1/scw_1.7.0-rc1_freebsd_386.zip [goxc:archive-zip] 2016/01/11 10:32:18 Artifact(s) archived to /go/src/github.com/scaleway/scaleway-cli/dist/1.7.0-rc1/scw_1.7.0-rc1_freebsd_arm.zip [goxc:archive-zip] 2016/01/11 10:32:18 Artifact(s) archived to /go/src/github.com/scaleway/scaleway-cli/dist/1.7.0-rc1/scw_1.7.0-rc1_windows_amd64.zip [goxc:archive-zip] 2016/01/11 10:32:18 Artifact(s) archived to /go/src/github.com/scaleway/scaleway-cli/dist/1.7.0-rc1/scw_1.7.0-rc1_freebsd_amd64.zip [goxc:archive-zip] 2016/01/11 10:32:19 Artifact(s) archived to /go/src/github.com/scaleway/scaleway-cli/dist/1.7.0-rc1/scw_1.7.0-rc1_darwin_386.zip [goxc:archive-zip] 2016/01/11 10:32:19 Artifact(s) archived to /go/src/github.com/scaleway/scaleway-cli/dist/1.7.0-rc1/scw_1.7.0-rc1_darwin_amd64.zip [goxc:archive-zip] 2016/01/11 10:32:20 Task archive-zip succeeded [goxc:archive-tar-gz] 2016/01/11 10:32:22 Task archive-tar-gz succeeded [goxc:deb] 2016/01/11 10:32:28 Task deb succeeded [goxc:deb-dev] 2016/01/11 10:32:28 Task deb-dev succeeded [goxc:downloads-page] 2016/01/11 10:32:28 Task downloads-page succeeded [goxc:deb-source] 2016/01/11 10:32:30 Task deb-source succeeded [goxc:downloads-page] 2016/01/11 10:32:30 Task downloads-page succeeded $
从GitHub拉取项目并构建Linux平台的可执行文件,仅需docker环境:
console$ docker run -it --rm -v /tmp:/dist multiarch/goxc sh -xec 'go get -d github.com/moul/anonuuid; goxc -bc=linux -wd /go/src/github.com/moul/anonuuid -env=GO15VENDOREXPERIMENT=1 -d /dist xc' + go get -d github.com/moul/anonuuid + goxc -bc=linux -wd /go/src/github.com/moul/anonuuid -env=GO15VENDOREXPERIMENT=1 -d /dist xc Adding GO15VENDOREXPERIMENT=1 [goxc:xc] 2016/01/11 11:57:19 Parallelizing xc for 3 platforms, using max 7 of 8 processors [goxc:xc] 2016/01/11 11:57:21 Task xc succeeded $ find /tmp/snapshot/ -ls 33685520 4 drwxr-xr-x 5 moul moul 4096 Jan 11 12:55 /tmp/snapshot/ 33685522 4 drwxr-xr-x 2 moul moul 4096 Jan 11 12:57 /tmp/snapshot/linux_arm 33685550 3360 -rwxr-xr-x 1 moul moul 3437720 Jan 11 12:57 /tmp/snapshot/linux_arm/anonuuid 33685549 4 drwxr-xr-x 2 moul moul 4096 Jan 11 12:57 /tmp/snapshot/linux_386 33685559 3368 -rwxr-xr-x 1 moul moul 3448120 Jan 11 12:57 /tmp/snapshot/linux_386/anonuuid 33685521 4 drwxr-xr-x 2 moul moul 4096 Jan 11 12:57 /tmp/snapshot/linux_amd64 33685560 4180 -rwxr-xr-x 1 moul moul 4279736 Jan 11 12:57 /tmp/snapshot/linux_amd64/anonuuid $
MIT许可证






探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像服务
在 Docker Desktop 配置镜像
Docker Compose 项目配置
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
MacOS OrbStack 容器配置
在宝塔面板一键配置镜像
Synology 群晖 NAS 配置
飞牛 fnOS 系统配置镜像
极空间 NAS 系统配置服务
爱快 iKuai 路由系统配置
绿联 NAS 系统配置镜像
QNAP 威联通 NAS 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
来自真实用户的反馈,见证轩辕镜像的优质服务