我已经部署了app.yaml
,worker.yaml
和queue.yaml
runtime: python27
由于我的工作人员更复杂,我需要安装第三方pips
和其他特定依赖项,例如openCV
- 因此我需要在自定义vm中运行此处理程序,这意味着Dockerfile
我想开始简单,运行以前有效的工作," hello world"在一个简单的python容器中。
所以我修改了worker.yaml
service: worker
api_version: 1
#runtime: vm # python27
runtime: custom
vm: true # python27
instance_class: B1
threadsafe: yes
manual_scaling:
instances: 1
network:
instance_tag: ssh
name: olympus-dev
env_variables:
PYTHON_ENV: lab
handlers:
- url: /.*
script: main.APP
#libraries:
#- name: jinja2
# version: latest
#
和app.yaml
runtime: custom
vm: true # python27
api_version: 1
threadsafe: true
network:
instance_tag: ssh
name: olympus-dev
env_variables:
PYTHON_ENV: lab
handlers:
- url: /.*
script: main.APP
#libraries:
#- name: jinja2
# version: latest
#
和Dockerfile
FROM gcr.io/google_appengine/python
# Create a virtualenv for dependencies. This isolates these packages from
# system-level packages.
RUN virtualenv /env
# Setting these environment variables are the same as running
# source /env/bin/activate.
ENV VIRTUAL_ENV /env
ENV PATH /env/bin:$PATH
# Copy the application's requirements.txt and run pip to install all
# dependencies into the virtualenv.
#ADD requirements.txt /app/requirements.txt
#RUN pip install -r /app/requirements.txt
# Add the application source code.
ADD . /app
# Run a WSGI server to serve the application. gunicorn must be declared as
# a dependency in requirements.txt.
CMD gunicorn -b :$PORT main:app