【问题标题】:Google App Engine Standard Python Cloud BuildGoogle App Engine 标准 Python 云构建
【发布时间】:2019-03-09 01:12:27
【问题描述】:

背景: 尝试使用新的 Google Cloud Build 自动化我的构建过程 1. 我正在使用 Angular 6.x 2.我使用的是python google app engine 标准

我按照这里的说明进行操作: https://cloud.google.com/cloud-build/docs/configuring-builds/build-test-deploy-artifacts#deploying_artifacts

Cloud Build 在基于对云存储库的更改触发后部署我的应用程序。

但是我的应用程序使用安装在此处描述的 lib 文件夹中的第 3 方 python 库:

https://cloud.google.com/appengine/docs/standard/python/tools/using-libraries-python-27

当云构建运行时,我希望它也从需求中安装 python 库

这是我的 cloudbuild.yaml 文件

steps:
# Use npm
#- name: 'gcr.io/cloud-builders/npm'
#  args: ['install', '-t', 'static/app', '.']
##- name: 'gcr.io/cloud-builders/npm'
##  args: ['test', '-t', 'static/app', '.']
#- name: 'gcr.io/cloud-builders/npm'
#  args: ['build', '-t','static/app', '.']

- name: 'gcr.io/cloud-builders/docker'
  args: ['build', '-t', 'gcr.io/my-project', '.']

- name: "gcr.io/cloud-builders/gcloud"
  args: ["app", "deploy"]

timeout: "1600s

这是我的 Dockerfile

FROM python:2.7

WORKDIR /app

COPY . /app

RUN pip install -t lib -r requirements.txt

##This does not help/work##
COPY /app/lib .

它正在使用 pip 拉下库,但努力寻找正确的语法将模块复制回主机?有 Docker 专家吗?

【问题讨论】:

    标签: docker dockerfile google-cloud-build


    【解决方案1】:

    我删除了 docker 文件,不需要它。

    在我的 cloudbuild.yaml 文件中添加了构建步骤

    - name: "docker.io/library/python:2.7"
      args: ['pip', 'install', '-t', '/workspace/lib', '-r', '/workspace/requirements.txt']
    

    这将为我的应用引擎应用安装 python 3rd 方库。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-12
      • 1970-01-01
      • 2018-08-16
      • 1970-01-01
      • 1970-01-01
      • 2018-07-01
      • 2020-01-05
      • 1970-01-01
      相关资源
      最近更新 更多