我们正在尝试将 golang 二进制文件部署到 cf。例如 main.exe 与 mainfest 文件一起位于 /deploy/ 文件夹中注意:还观察到,如果我们推送整个项目应用程序,那么它就可以工作。但是如果我们尝试只推送二进制文件,那么我们会得到以下错误清单文件包含以下信息 applications: - name: test-app command: test-app env: GO_INSTALL_PACKAGE_SPEC: ./**ERROR** To use go native vendoring set the $GOPACKAGENAME environment variable to your app's package name **ERROR** Unable to determine import path: GOPACKAGENAME unset添加 GOPACKAGENAME: main 后,因为 main.exe 是我们的二进制名称,我们在下面收到以下错误 Failed to compile droplet: Failed to run finalize script: exit status 12 Cell 507b6e9c-c5c5-4685-9a71-d7cc1c876f5a stopping instance 6a92ff73-76ec-4baf-8a3e-54b54cfa307eBuildpackCompileFailed - App staging failed in the buildpack compile phase
1 回答
忽然笑
TA贡献1806条经验 获得超5个赞
对于上述问题:
首先我们必须使用以下命令构建(使用 make 文件)
GOOS="linux" go build main.go
然后将该主二进制文件复制到 /deploy 文件夹
然后清单文件在部署文件夹中
applications:
- name: test-app
command: ./main
stack: cflinuxfs3
buildpacks:
- https://github.com/cloudfoundry/binary-buildpack.git
然后推送到cf
cf push -f ./manifest-template.yml
- 1 回答
- 0 关注
- 147 浏览
添加回答
举报
0/150
提交
取消
