Skip to content

Commit

Permalink
Complete the deployment script
Browse files Browse the repository at this point in the history
  • Loading branch information
omaryasser committed Apr 4, 2024
1 parent 0fa6964 commit 2f339ec
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 2 deletions.
12 changes: 10 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ set -e

docker build --platform linux/amd64 -t tanafaso .

docker tag tanafaso europe-west1-docker.pkg.dev/tanafaso/tanafaso/tanafaso
random_tag=$(printf "randomtag%08d" $((RANDOM%100000000)))

docker push europe-west1-docker.pkg.dev/tanafaso/tanafaso/tanafaso:latest
docker tag tanafaso europe-west1-docker.pkg.dev/tanafaso/tanafaso/tanafaso:$random_tag

docker push europe-west1-docker.pkg.dev/tanafaso/tanafaso/tanafaso:$random_tag

sed -i '' "s|image: europe-west1-docker.pkg.dev/tanafaso/tanafaso/tanafaso:.*|image: europe-west1-docker.pkg.dev/tanafaso/tanafaso/tanafaso:$random_tag|" tanafaso-cloud-run-service.yaml

gcloud run services replace tanafaso-cloud-run-service.yaml --region europe-west1

echo "Deployed with tag: $random_tag"

43 changes: 43 additions & 0 deletions tanafaso-cloud-run-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: tanafaso
namespace: 'tanafaso'
labels:
cloud.googleapis.com/location: europe-west1
annotations:
run.googleapis.com/ingress: all
run.googleapis.com/ingress-status: all
spec:
template:
metadata:
labels:
run.googleapis.com/startupProbeType: Custom
annotations:
autoscaling.knative.dev/minScale: '1'
autoscaling.knative.dev/maxScale: '1'
run.googleapis.com/startup-cpu-boost: 'true'
spec:
containerConcurrency: 60
timeoutSeconds: 15
containers:
- name: tanafaso-1
image: europe-west1-docker.pkg.dev/tanafaso/tanafaso/tanafaso:randomtag00029163
ports:
- name: http1
containerPort: 443
resources:
limits:
cpu: 1000m
memory: 1Gi
startupProbe:
initialDelaySeconds: 8
timeoutSeconds: 1
periodSeconds: 5
failureThreshold: 15
httpGet:
path: /
port: 443
traffic:
- percent: 100
latestRevision: true

0 comments on commit 2f339ec

Please sign in to comment.