Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google App Engine Standard Python Cloud Build

Background: Trying to automate my build process using the new Google Cloud Build 1. I am using Angular 6.x 2. I am using python google app engine standard

I followed the instructions here: https://cloud.google.com/cloud-build/docs/configuring-builds/build-test-deploy-artifacts#deploying_artifacts

Cloud Build is deploying my application after a trigger based on a changes to a cloud repository.

However my app uses 3rd party python libraries which are installed in the lib folder described here:

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

When cloud build runs I want it to also install the python libraries from requirements

This is my cloudbuild.yaml file

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

This is my 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 .

It is pulling down the libraries with pip but struggling trying to find the right syntax to copy the modules back to the host? Any Docker experts?

like image 465
bscott Avatar asked Oct 03 '18 18:10

bscott


1 Answers

I removed the docker file, it is not needed.

Added a build step to my cloudbuild.yaml file

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

This installs the python 3rd party libraries for my app engine app.

like image 83
bscott Avatar answered Oct 20 '22 18:10

bscott