将Go 1.6的Web应用部署到AWS Elastic Beanstalk。

huangapple go评论87阅读模式
英文:

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的步骤:

  1. 在创建新环境时,选择通用Docker平台。
  2. 在项目根目录下放置一个名为Dockerfile的文件,内容如下:

FROM golang:1.6.2-onbuild
EXPOSE 80

  1. main.go中添加一个规范的导入路径。例如,如果你的包名是my/packagemain.go的第一行应该是package main // import "my/package"
  2. 让你的应用程序监听80端口
  3. 部署!
英文:

The best choice would be to use docker.

Here are the steps to deploy your application to Elastic Beanstalk:

  1. Choose the Generic Docker platform when creating a new environment.
  2. Put a file named Dockerfile in your project root with the following content:

FROM golang:1.6.2-onbuild
EXPOSE 80

  1. Add a canonical import path to your main.go. For example, if your package name is my/package the first line of main.go should be package main // import "my/package"
  2. Make your application listen on port 80
  3. Deploy!

huangapple
  • 本文由 发表于 2016年3月19日 23:10:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/36103362.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定