是否将Go 1.6 Web应用程序部署到AWS Elastic Beanstalk?
问题描述:
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.
我想将我的Web应用程序部署到弹性beantalk,但它似乎仅支持Go 1.4而不是Go 1.6。 有没有办法获得自定义图像? p>
我想要1.6的原因是因为它支持供应商,并且我的Web应用程序依赖于第三方包装。 p> div>
答
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!