Skip to content

Commit

Permalink
Merge pull request #1 from kinoute/patch-1
Browse files Browse the repository at this point in the history
refactoring, deleting useless repetitions
  • Loading branch information
aquadzn authored Oct 15, 2019
2 parents fe60854 + 7b39ff0 commit 79c232a
Showing 1 changed file with 17 additions and 33 deletions.
50 changes: 17 additions & 33 deletions deploy_cloudrun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,25 @@
read -p 'Do yo want to delete images on GCR after building CloudRun services ? (y/n) : ' question
echo -e "Warning!\nThis can take some time because of the size of images.\n"

if [ "$question" != "${question#[Yy]}" ]; then
for d in gpt2-models/*; do
# Push images to GCR
[ -f "$d" ] && continue
tag=$(echo "$d" | cut -d "/" -f2-)
gcloud builds submit "$d" --tag "gcr.io/deep-learning-254808/$tag"
for d in gpt2-models/*; do

# Create CloudRun services
gcloud beta run deploy "$tag" \
--image "gcr.io/deep-learning-254808/$tag" \
--platform=managed \
--allow-unauthenticated \
--region=us-east1 \
--concurrency=1 \
--memory=2Gi
# Push images to GCR
[ -f "$d" ] && continue
tag=$(echo "$d" | cut -d "/" -f2-)
gcloud builds submit "$d" --tag "gcr.io/deep-learning-254808/$tag"

# Delete images on GCR to save money?
gcloud container images delete "gcr.io/deep-learning-254808/$tag"
done
else
for d in gpt2-models/*; do
# Push images to GCR
[ -f "$d" ] && continue
tag=$(echo "$d" | cut -d "/" -f2-)
gcloud builds submit "$d" --tag "gcr.io/deep-learning-254808/$tag"
# Create CloudRun services
gcloud beta run deploy "$tag" \
--image "gcr.io/deep-learning-254808/$tag" \
--platform=managed \
--allow-unauthenticated \
--region=us-east1 \
--concurrency=1 \
--memory=2Gi

# Create CloudRun services
gcloud beta run deploy "$tag" \
--image "gcr.io/deep-learning-254808/$tag" \
--platform=managed \
--allow-unauthenticated \
--region=us-east1 \
--concurrency=1 \
--memory=2Gi
done
fi
# Delete images on GCR to save money?
[ "$question" != "${question#[Yy]}" ] && gcloud container images delete "gcr.io/deep-learning-254808/$tag"

done

echo -e "\nDone!\nURLs of Cloud Run services:\n\n$(gcloud beta run services list --platform=managed |grep -Po 'https.?://\S+')"

0 comments on commit 79c232a

Please sign in to comment.