Created
December 6, 2016 01:56
-
-
Save wasnot/48358f0d2c7e1d793020f7a5d8d1d676 to your computer and use it in GitHub Desktop.
DockerのイメージをGAE/FEにデプロイする ref: http://qiita.com/wasnot/items/b8691bb4940e6f4a9c24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bottle import Bottle | |
app = Bottle() | |
@app.route(['/hello', '/']) | |
def hello(): | |
return "Hello World!" | |
@app.route("/_ah/health") | |
def _ah_health(): | |
return "ok" | |
if __name__ == '__main__': | |
# waiting request | |
app.run(host='0.0.0.0', port=8080, debug=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 自動生成部分 | |
entrypoint: python app.py | |
runtime: custom | |
vm: true | |
# もしモジュール(サービス)を分割する場合は指定しておく | |
service: flex | |
# オートスケーリングだとデフォルト2台待機なので少なくしたりする | |
automatic_scaling: | |
min_num_instances: 1 | |
max_num_instances: 20 | |
# マシンタイプはデフォルトミニマムなので適宜指定。これは下から二つ目。 | |
resources: | |
cpu: .5 | |
memory_gb: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gcloud beta app gen-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM gcr.io/google_appengine/python:1.3 | |
# ここではpython2.7が指定されています。 | |
RUN virtualenv /env -p python | |
# Set virtualenv environment variables. This is equivalent to running | |
# source /env/bin/activate | |
ENV VIRTUAL_ENV /env | |
ENV PATH /env/bin:$PATH | |
ADD . /app/ | |
# こんなのを加えるとスムーズに環境構築されると思います。 | |
RUN pip install -r requirements.txt | |
CMD python app.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gcloud beta app deploy --project my-project --version flex |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment