Skip to content

Commit

Permalink
* add Cloud Run config deployment for dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
AuHoh committed Jul 13, 2023
1 parent 7929235 commit 7b2c422
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dashboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.8-slim

RUN apt-get update -y

COPY ./dashboard /app
WORKDIR /app
RUN pip install -r requirements.txt

EXPOSE 8080
ENTRYPOINT ["streamlit", "run", "main.py", "–server.port=8080", "–server.address=0.0.0.0"]
59 changes: 59 additions & 0 deletions dashboard/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
steps:
# This step builds the container image.
- name: 'gcr.io/cloud-builders/docker'
id: Build image
args:
- 'build'
- '-t'
- 'europe-west1-docker.pkg.dev/p7-formation-ah/dashboard-image/dashboard-app-build:$SHORT_SHA'
- './dashboard'

# This step pushes the image to Container Registry
# The PROJECT_ID and SHORT_SHA variables are automatically
# replaced by Cloud Build.
- name: 'gcr.io/cloud-builders/docker'
id: Push image
args:
- 'push'
- 'europe-west1-docker.pkg.dev/p7-formation-ah/dashboard-image/dashboard-app-build:$SHORT_SHA'

# add latest tag to image
- name: 'gcr.io/cloud-builders/gcloud'
id: Tag image with latest
args:
- 'container'
- 'images'
- 'add-tag'
- 'europe-west1-docker.pkg.dev/p7-formation-ah/dashboard-image/dashboard-app-build:$SHORT_SHA'
- 'europe-west1-docker.pkg.dev/p7-formation-ah/dashboard-image/dashboard-app-build:latest'

- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
id: Cloud Run deployment
entrypoint: gcloud
args:
- 'run'
- 'deploy'
- 'dashboard-app'
- '--image'
- 'europe-west1-docker.pkg.dev/p7-formation-ah/dashboard-image/dashboard-app-build:latest'
- '--region'
- 'europe-west1'
- '--platform'
- 'managed'
- '--cpu'
- '2'
- '--memory'
- '4Gi'
- '--service-account'
- '[email protected]'
- '--concurrency'
- '80'
- '--min-instances'
- '0'
- '--max-instances'
- '1'
- '--timeout'
- '10m'
- '--port'
- '8080'
- '--allow-unauthenticated'
6 changes: 6 additions & 0 deletions dashboard/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pandas==1.5.3
smart-open[gcs]==6.3.0
streamlit==1.24.0
matplotlib==3.6.3
seaborn==0.12.2
Pillow==9.4.0

0 comments on commit 7b2c422

Please sign in to comment.