【发布时间】:2019-03-07 03:29:40
【问题描述】:
这是压缩文件之前文件的组织方式。
├── app
│ ├── main.go
│ ├── Procfile
│ ├── Buildfile
│ ├── build.sh
构建文件
make: ./build.sh
build.sh
#!/usr/bin/env bash
# Install dependencies.
go get ./...
# Build app
go build ./ -o bin/application
过程文件
web: bin/application
我得到的错误
[实例:i-03f3c230e7b575431] 实例上的命令失败。返回代码:1 输出:(截断)... 膨胀:/var/app/staging/app/main.go 无法启动应用程序,因为源包不包含 Buildfile、Procfile 或可执行文件。无法启动应用程序,因为源包不包含 Buildfile、Procfile 或可执行文件。挂钩 /opt/elasticbeanstalk/hooks/appdeploy/pre/01_configure_application.sh 失败。有关更多详细信息,请使用控制台或 EB CLI 检查 /var/log/eb-activity.log。
更多错误日志
Application update failed at 2018-10-02T01:33:44Z with exit status 1 and error: Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/01_configure_application.sh failed.
Executing: /usr/bin/unzip -o -d /var/app/staging /opt/elasticbeanstalk/deploy/appsource/source_bundle
Archive: /opt/elasticbeanstalk/deploy/appsource/source_bundle
creating: /var/app/staging/app/
inflating: /var/app/staging/app/Buildfile
inflating: /var/app/staging/app/build.sh
inflating: /var/app/staging/app/Procfile
inflating: /var/app/staging/app/main.go
Unable to launch application as the source bundle does not contain a Buildfile, Procfile or an executable.
Unable to launch application as the source bundle does not contain a Buildfile, Procfile or an executable.
Incorrect application version ".01" (deployment 29). Expected version ".01" (deployment 18).
我的 main.go 文件有第三方包。我正在使用
port := os.Getenv("PORT")
if port == "" {
port = "5000"
log.Println("[-] No PORT environment variable detected. Setting to ", port)
}
就像文档在示例应用程序中所说的那样。它在本地编译和运行没有问题。
【问题讨论】:
标签: go amazon-elastic-beanstalk