Skip to content

Deploy TransformationSvc to PathCloud Google Cloud Run Jobs

Pre-requisites

  • Google Cloud SDK https://cloud.google.com/sdk/docs/install

ImageTransformation FastAPI Service

Build the container image

docker build --pull --rm -f "container/Dockerfile" -t imagetransformsvc_worker:1.4.1 .

Tag the container image

docker tag imagetransformsvc_worker:1.4.1 us-west2-docker.pkg.dev/gcp-pathology-poc1/image-transform-svc/imagetransformsvc_worker:1.4.1

Push the container image to Google Container Registry

gcloud auth login
docker push us-west2-docker.pkg.dev/gcp-pathology-poc1/image-transform-svc/imagetransformsvc_worker:1.4.1

Deploy to GCP Cloud Run

gcloud config set project gcp-pathology-poc1 && \
gcloud beta run deploy image-transform-svc --image us-west2-docker.pkg.dev/gcp-pathology-poc1/image-transform-svc/image-transform-svc:1.4.1 \
--region=us-west2 --allow-unauthenticated \
--command=hypercorn \
--args=app:app,-w,8,-b,0.0.0.0:8080,--keep-alive,3600
--port 8080 --memory 16G --cpu 8 \
--network default --subnet default \
--add-volume name=temp_files,type=cloud-storage,bucket=gcp-pathology-poc1-image-transformation-transformation-temp \
--add-volume-mount volume=temp_files,mount-path=/temp_files \
--update-secrets=/secrets/slide-dicom-store-gcp-pathology-service.json=slide-dicom-store-gcp-pathology-service:latest \
--set-env-vars="ITS_SERVICE_ACCOUNT_KEY_LOCATION=/secrets/slide-dicom-store-gcp-pathology-service.json" \
--set-env-vars="ITS_URL=https://dicom.poc1.gestaltcloud.com/proxy01/projects/gcp-pathology-poc1/locations/us-west2/datasets/dicom-pathology/dicomStores/slide-dicom-store-public/dicomWeb" \
--set-env-vars="ITS_HANDLER=Inline" \
--set-env-vars="ITS_KEEP_FILES_PATH=/temp_files" \
--set-env-vars="ITS_SFTPFileInputPath=/temp_files/Input" \
--set-env-vars="ITS_SFTPFileOutputPath=/temp_files/Output" \
--set-env-vars="ITS_MODE=default" \
--set-env-vars="ITS_CELERY_BROKER_URL=redis://10.158.57.91:6379/9" \
--set-env-vars="ITS_CELERY_RESULT_BACKEND=redis://10.158.57.91:6379/9" \

Update the service with a new image

gcloud beta run services update image-transform-svc --image us-west2-docker.pkg.dev/gcp-pathology-poc1/image-transform-svc/imagetransformsvc_worker:1.4.1 --region=us-west2 --command=hypercorn --args=app:app,-w,8,-b,0.0.0.0:8080,--keep-alive,3600