Skip to content

Commit

Permalink
GoogleCloudPlatform#220 - DockerFile ok
Browse files Browse the repository at this point in the history
  • Loading branch information
obriensystems committed Jan 10, 2023
1 parent ce79ebb commit 6477e4d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 3 additions & 2 deletions solutions/document-processing/apps/master/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./
COPY solutions/document-processing/apps/master/requirements.txt requirements.txt

COPY solutions/document-processing/apps/master/main.py main.py
# Install production dependencies.
RUN pip install --no-cache-dir -r requirements.txt

Expand All @@ -20,5 +20,6 @@ RUN pip install --no-cache-dir -r requirements.txt
# For environments with multiple CPU cores, increase the number of workers
# to be equal to the cores available.
# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 solutions/document-processing/apps/master/main:app
#CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 --chdir solutions/document-processing/apps/master main:app
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app

9 changes: 7 additions & 2 deletions solutions/document-processing/apps/master/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ steps:
# Docker Build
# ${_ARTIFACT_REGISTRY_REPO}
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t',
'us-central1-docker.pkg.dev/${PROJECT_ID}/docproc3/dp-master:${SHORT_SHA}', '-f', 'solutions/document-processing/apps/master/Dockerfile', '.']
#env:
# - 'CSR_REPO=${_CSR_REPO}'
args: ['build',
'--build-arg',
'AR_NAME=${_AR_NAME}',
'-t',
'us-central1-docker.pkg.dev/${PROJECT_ID}/${_AR_NAME}/dp-master:${SHORT_SHA}', '-f', 'solutions/document-processing/apps/master/Dockerfile', '.']
# [END cloudbuild_python_image_yaml]

# [START cloudbuild_python_push_yaml]
Expand Down
4 changes: 2 additions & 2 deletions solutions/document-processing/gcloud/deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ create_cloudbuild_prod() {
#gcloud alpha builds trigger create cloud-source-repositories --trigger-config=cloudbuild.yaml --project=$PROJECT_ID

# https://github.com/GoogleCloudPlatform/cloud-build-samples/blob/main/python-example-flask/cloudbuild.yaml
gcloud beta builds triggers create cloud-source-repositories --repo=$CSR_NAME --branch-pattern=$CSR_BRANCH_OTHER_THAN_MAIN --name="${CLOUDBUILD_TRIGGER_PROD_MAIN}" --build-config=solutions/document-processing/apps/master/cloudbuild.yaml
gcloud beta builds triggers create cloud-source-repositories --repo=$CSR_NAME --branch-pattern=$CSR_BRANCH_OTHER_THAN_MAIN --name="${CLOUDBUILD_TRIGGER_PROD_MAIN}" --substitutions=_AR_NAME="${AR_NAME}",_NODE_VERSION_2="v6.9.5" --build-config=solutions/document-processing/apps/master/cloudbuild.yaml


}
Expand Down Expand Up @@ -497,7 +497,7 @@ gcloud run deploy ${CLOUD_RUN_MASTER_NAME} \
--service-account=${PROJECT_NUMBER}-compute@developer.gserviceaccount.com \
--min-instances=1 \
--max-instances=10 \
--set-env-vars=GCS_BUCKET=${GCSBUCKET}=bucket,HOSTPATH=${HOSTPATH_MASTER} \
--set-env-vars=GCS_BUCKET=${GCSBUCKET=default},HOSTPATH=${HOSTPATH_MASTER=default} \
--no-cpu-throttling \
--execution-environment=gen2 \
--region=${REGION} \
Expand Down

0 comments on commit 6477e4d

Please sign in to comment.