Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@smagch
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smagch/cc662d64adfee190caa0 to your computer and use it in GitHub Desktop.
Save smagch/cc662d64adfee190caa0 to your computer and use it in GitHub Desktop.
AWS初心者のElastic Beanstalk体験談

AWS初心者のElastic Beanstalk(Docker)体験談

Docker勉強会@旭川のLTです。

  1. Elastic BeanstalkでGoのWebアプリをデプロイ。
  2. 最初はebコマンドを試す。
  3. aws elasticbeanstalkコマンドの方が、Low Levelで使い勝手が良いので、そっちを使う。
  4. むしろ、Cloudformationから、Elastic Beanstalkを使ったほうが、痒い所に手が届くので、Cloudformationを勉強し始める。

成果物: https://github.com/smagch/cloudformation-elastic-beanstak-docker-go-example

本当は、Resourceスタックと、Elastic BeanstalkのAppスタックの2つを、マスターテンプレートからネストスタックをデプロイする練習をしたかったけど、今のところはAppスタックしかない。

Dockerに関して

オフィシャルのgolangイメージの中に、golang:1.3.3-onbuildというやつがあります。

しかし、これではgo-wrapper downloadコマンド(つまりgo get)が実行されて、レポジトリごとソースを引っ張っくるので、遅い。ですので、GodepでVendoringをして、もう一つのGOPATHを付け加えます。

FROM golang:1.3.3

RUN mkdir -p /go/src/app
WORKDIR /go/src/app
COPY . /go/src/app

ENV GOPATH /go/src/app/Godeps/_workspace:$GOPATH
ENV PATH /go/src/app/Godeps/_workspace/bin:$PATH

EXPOSE 8080
RUN ["go", "install", "."]
CMD ["./bin/start.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment