将Go 1.6 Web应用程序部署到AWS Elastic Beanstalk? [英] Deploying Go 1.6 web app to AWS Elastic Beanstalk?
本文介绍了将Go 1.6 Web应用程序部署到AWS Elastic Beanstalk?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将我的web应用部署到弹性beanstalk,但它似乎只支持Go 1.4而不是Go 1.6。有没有办法得到一个自定义图像?
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?
我想要1.6的原因是它支持vendoring,我的web应用程序依赖于第三方包。
The reason I want 1.6 is because it supports vendoring and my web app depends on 3rd party packages.
推荐答案
最好的选择是使用 docker 。
The best choice would be to use docker.
以下是将应用程序部署到Elastic Beanstalk的步骤: p>
Here are the steps to deploy your application to Elastic Beanstalk:
- 创建新环境时选择通用Docker 平台。
- 一个名为
Dockerfile
的文件,包含以下内容:
- 一个名为
- 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
- 添加 规范导入路径 添加到您的
main.go
。例如,如果你的包名是my / package
,那么main.go
的第一行应该是package main // importmy / package
- 使您的应用程序侦听端口80 $ b
- 部署!
- 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!
这篇关于将Go 1.6 Web应用程序部署到AWS Elastic Beanstalk?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文