将Go 1.6 Web应用程序部署到AWS Elastic Beanstalk? [英] Deploying Go 1.6 web app to AWS Elastic Beanstalk?

查看:173
本文介绍了将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:


  1. 创建新环境时选择通用Docker 平台。
  2. 一个名为 Dockerfile 的文件,包含以下内容:

  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. 添加 规范导入路径 添加到您的 main.go 。例如,如果你的包名是 my / package ,那么 main.go 的第一行应该是 package main // importmy / package

  2. 使您的应用程序侦听端口80
  3. $ b
  4. 部署!

  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!

这篇关于将Go 1.6 Web应用程序部署到AWS Elastic Beanstalk?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆