mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Use build arguments, refs #1522
This commit is contained in:
parent
c617e1769e
commit
a1ba6cd6bb
3 changed files with 48 additions and 17 deletions
|
|
@ -1,13 +1,30 @@
|
|||
#!/bin/bash
|
||||
# https://til.simonwillison.net/cloudrun/ship-dockerfile-to-cloud-run
|
||||
# https://til.simonwillison.net/cloudrun/using-build-args-with-cloud-run
|
||||
|
||||
if [[ -z "$DATASETTE_REF" ]]; then
|
||||
echo "Must provide DATASETTE_REF environment variable" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NAME="datasette-apache-proxy-demo"
|
||||
PROJECT=$(gcloud config get-value project)
|
||||
IMAGE="gcr.io/$PROJECT/$NAME"
|
||||
|
||||
gcloud builds submit --tag $IMAGE
|
||||
gcloud run deploy \
|
||||
--allow-unauthenticated \
|
||||
--platform=managed \
|
||||
--image $IMAGE $NAME \
|
||||
--port 80
|
||||
# Need YAML so we can set --build-arg
|
||||
echo "
|
||||
steps:
|
||||
- name: 'gcr.io/cloud-builders/docker'
|
||||
args: ['build', '-t', '$IMAGE', '.', '--build-arg', 'DATASETTE_REF=$DATASETTE_REF']
|
||||
- name: 'gcr.io/cloud-builders/docker'
|
||||
args: ['push', '$IMAGE']
|
||||
" > /tmp/cloudbuild.yml
|
||||
|
||||
gcloud builds submit --config /tmp/cloudbuild.yml
|
||||
|
||||
rm /tmp/cloudbuild.yml
|
||||
|
||||
gcloud run deploy $NAME \
|
||||
--allow-unauthenticated \
|
||||
--platform=managed \
|
||||
--image $IMAGE \
|
||||
--port 80
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue