Skip to content

Instantly share code, notes, and snippets.

@glorat
Last active May 7, 2024 13:50
Show Gist options
  • Save glorat/e4543c0868b79b69b9e733de10dfe66a to your computer and use it in GitHub Desktop.
Save glorat/e4543c0868b79b69b9e733de10dfe66a to your computer and use it in GitHub Desktop.
Import unstructured-api image to artifact registry for use with Google Cloud Run
steps:
- name: 'gcr.io/cloud-builders/docker'
args:
- 'pull'
- 'quay.io/unstructured-io/unstructured-api:latest'
- name: 'gcr.io/cloud-builders/docker'
args:
- 'tag'
- 'quay.io/unstructured-io/unstructured-api:latest'
- 'asia-southeast1-docker.pkg.dev/glorat-gptapps/sg-unstructured/unstructured-api:latest'
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'asia-southeast1-docker.pkg.dev/glorat-gptapps/sg-unstructured/unstructured-api:latest'
# Create the artifact repository (once)
gcloud artifacts repositories create external \
--repository-format=docker \
--location=us-central1 \
--description="Docker repository for external dependencies"
# gcrane setup
curl -L \
https://github.com/google/go-containerregistry/releases/latest/download/go-containerregistry_Linux_x86_64.tar.gz \
-o go-containerregistry.tar.gz
tar -zxvf go-containerregistry.tar.gz
chmod +x gcrane
sudo mv gcrane /usr/local/bin/
# then one liner with gcrane to update as needed
gcrane cp downloads.unstructured.io/unstructured-io/unstructured-api:latest us-central1-docker.pkg.dev/$GOOGLE_CLOUD_PROJECT/external/unstructured-api:latest
gcloud artifacts repositories create unstructured \
--repository-format=docker \
--location=us-central1 \
--description="Private virtual repository for mirroring unstructured API" \
--mode=remote-repository \
--remote-docker-repo=https://downloads.unstructured.io
gcloud run deploy unstructured-api \
--image=us-central1-docker.pkg.dev/$GOOGLE_CLOUD_PROJECT/unstructured/unstructured-io/unstructured-api:latest \
--allow-unauthenticated \
--port=8000 \
--concurrency=10 \
--timeout=600 \
--cpu=2 \
--memory=4Gi \
--max-instances=4 \
--execution-environment=gen1 \
--region=us-central1 \
--project=$GOOGLE_CLOUD_PROJECT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment