File size: 1,857 Bytes
565a379
21a19e7
565a379
21a19e7
565a379
21a19e7
565a379
21a19e7
565a379
21a19e7
 
 
 
 
 
 
565a379
 
 
 
 
 
21a19e7
 
 
 
 
 
 
 
 
 
 
 
 
565a379
 
21a19e7
 
 
 
 
 
 
 
cc2fef3
 
21a19e7
 
cc2fef3
 
 
 
565a379
21a19e7
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
steps:
  # 1. Build the API/Worker image
  - name: 'gcr.io/cloud-builders/docker'
    args: ['build', '-t', 'gcr.io/$PROJECT_ID/mathminds-backend:latest', '.']
  
  # 2. Build the Frontend image
  - name: 'gcr.io/cloud-builders/docker'
    args: ['build', '-t', 'gcr.io/$PROJECT_ID/mathminds-frontend:latest', '-f', 'frontend/Dockerfile', '.']
  
  # 3. Push images
  - name: 'gcr.io/cloud-builders/docker'
    args: ['push', 'gcr.io/$PROJECT_ID/mathminds-backend:latest']
  - name: 'gcr.io/cloud-builders/docker'
    args: ['push', 'gcr.io/$PROJECT_ID/mathminds-frontend:latest']
  
  # 4. Deploy API
  - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
    entrypoint: gcloud
    args:
      - 'run'
      - 'deploy'
      - 'mathminds-api'
      - '--image=gcr.io/$PROJECT_ID/mathminds-backend:latest'
      - '--region=us-central1'
      - '--allow-unauthenticated'
      - '--set-env-vars=ENV=production'

  # 5. Deploy Frontend
  - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
    entrypoint: gcloud
    args:
      - 'run'
      - 'deploy'
      - 'mathminds-frontend'
      - '--image=gcr.io/$PROJECT_ID/mathminds-frontend:latest'
      - '--region=us-central1'
      - '--allow-unauthenticated'

  # 6. Deploy Worker (as a job or long-running service - Cloud Run supports this now)
  - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
    entrypoint: gcloud
    args:
      - 'run'
      - 'deploy'
      - 'mathminds-worker'
      - '--set-env-vars=ENV=production,REDIS_URL=$_REDIS_URL,MONGO_URI=$_MONGO_URI'
      - '--min-instances=1'
      - '--command=celery,-A,app.worker.celery_app,worker,--loglevel=info,--pool=solo'

substitutions:
  _REDIS_URL: "redis://localhost:6379/0"
  _MONGO_URI: "mongodb://localhost:27017/mathminds"

images:
  - 'gcr.io/$PROJECT_ID/mathminds-backend:latest'
  - 'gcr.io/$PROJECT_ID/mathminds-frontend:latest'