Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';t将go lang应用程序部署到AWS Elastic Beanstalk_Go_Amazon Elastic Beanstalk - Fatal编程技术网

Can';t将go lang应用程序部署到AWS Elastic Beanstalk

Can';t将go lang应用程序部署到AWS Elastic Beanstalk,go,amazon-elastic-beanstalk,Go,Amazon Elastic Beanstalk,以下是在压缩文件之前如何组织文件 ├── 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/applica

以下是在压缩文件之前如何组织文件

├── 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无法启动应用程序,因为源捆绑包不包含构建文件、过程文件或可执行文件。无法启动应用程序,因为源捆绑包不包含构建文件、Procfile或可执行文件。Hook/opt/elasticbeanstalk/hooks/appdeploy/pre/01_configure_application.sh失败。有关更多详细信息,请使用console或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)
}

就像示例应用程序中的文档所说的那样。它在本地编译和运行没有问题。

正如您在错误消息中看到的:

无法启动应用程序,因为源捆绑包不包含构建文件、Procfile或可执行文件

Procfile、Buildfile和build.sh应该位于项目的根目录中,如下所示:

├── app
│   ├── main.go
│   Procfile
│   Buildfile
│   build.sh