英文:
Deploying Go 1.6 web app to AWS Elastic Beanstalk?
问题
我想将我的Web应用部署到Elastic Beanstalk,但它似乎只支持Go 1.4而不是Go 1.6。有没有办法获取自定义镜像?
我想要1.6版本是因为它支持vendoring,并且我的Web应用依赖于第三方包。
英文:
I want to deploy my web app to elastic beanstalk but it appears to only support Go 1.4 rather than Go 1.6. Is there a way to get a custom image?
The reason I want 1.6 is because it supports vendoring and my web app depends on 3rd party packages.
答案1
得分: 2
最好的选择是使用docker。
以下是将应用程序部署到Elastic Beanstalk的步骤:
- 在创建新环境时,选择通用Docker平台。
- 在项目根目录下放置一个名为
Dockerfile
的文件,内容如下:
FROM golang:1.6.2-onbuild
EXPOSE 80
- 在
main.go
中添加一个规范的导入路径。例如,如果你的包名是my/package
,main.go
的第一行应该是package main // import "my/package"
- 让你的应用程序监听80端口
- 部署!
英文:
The best choice would be to use docker.
Here are the steps to deploy your application to Elastic Beanstalk:
- Choose the Generic Docker platform when creating a new environment.
- Put a file named
Dockerfile
in your project root with the following content:
FROM golang:1.6.2-onbuild
EXPOSE 80
- Add a canonical import path to your
main.go
. For example, if your package name ismy/package
the first line ofmain.go
should bepackage main // import "my/package"
- Make your application listen on port 80
- Deploy!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论