Skip to content

Commit

Permalink
Merge pull request #11 from prefeitura-rio/staging
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
lucastavarex authored Dec 12, 2024
2 parents 95a9d19 + b1fdd28 commit 00514cd
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions cloudbuild-prod.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
steps:
# Create the .env file
# Create the .env.prod file with environment variables
- name: "gcr.io/cloud-builders/gcloud"
entrypoint: "bash"
args:
args:
- "-c"
- |
echo "NEXT_PUBLIC_ENV=production" > .env.production
echo "NEXT_PUBLIC_ENV=staging" > .env.production
echo "NEXT_PUBLIC_ROOT_URL_PROD=https://gw.dados.rio/plataforma-clima-staging/" >> .env.production
echo "NEXT_PUBLIC_ROOT_URL_DEV=https://gw.dados.rio/plataforma-clima-staging/" >> .env.production
echo "NEXT_PUBLIC_MAPBOX_API_KEY=pk.eyJ1IjoiZXNjcml0b3Jpb2RlZGFkb3MiLCJhIjoiY2t3bWdmcHpjMmJ2cTJucWJ4MGQ1Mm1kbiJ9.4hHJX-1pSevYoBbja7Pq4w" >> .env.production
# Build the container image
- name: "gcr.io/cloud-builders/docker"
args: ["build", "-t", "gcr.io/$PROJECT_ID/plataforma-clima:$COMMIT_SHA", "."]
args:
["build", "-t", "gcr.io/$PROJECT_ID/plataforma-clima:$COMMIT_SHA", "."]

# Push the container image to Container Registry
- name: "gcr.io/cloud-builders/docker"
args: ["push", "gcr.io/$PROJECT_ID/plataforma-clima:$COMMIT_SHA"]

# Kustomize: set the image in the kustomization.yaml file
- name: "gcr.io/cloud-builders/gke-deploy"
dir: "k8s/prod"
Expand All @@ -24,11 +28,13 @@ steps:
- "set"
- "image"
- "gcr.io/project-id/plataforma-clima=gcr.io/$PROJECT_ID/plataforma-clima:$COMMIT_SHA"

# Kustomize: apply the kustomization.yaml file
- name: "gcr.io/cloud-builders/gke-deploy"
dir: "k8s/prod"
entrypoint: "kustomize"
args: ["build", ".", "-o", "prod.yaml"]

# Deploy the application to the GKE cluster
- name: "gcr.io/cloud-builders/gke-deploy"
dir: "k8s/prod"
Expand All @@ -40,4 +46,4 @@ steps:
- "--project=datario"

images:
- "gcr.io/$PROJECT_ID/plataforma-clima:$COMMIT_SHA"
- "gcr.io/$PROJECT_ID/plataforma-clima:$COMMIT_SHA"

0 comments on commit 00514cd

Please sign in to comment.