Skip to content

Commit

Permalink
change image name
Browse files Browse the repository at this point in the history
  • Loading branch information
PeeQuessada committed Mar 14, 2024
1 parent 768304a commit 337c2de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/deploy-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:
DB_USERNAME: ${{ vars.DB_USERNAME}}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_NAME: "postgres"
IMAGE_NAME: ${{ vars.REGION }}-docker.pkg.dev/${{ vars.PROJECT_ID }}/${{ vars.prefix }}-${{ vars.PROJECT_ID }}/app:${{ github.run_id }}
IMAGE_NAME: ${{ vars.REGION }}-docker.pkg.dev/${{ vars.PROJECT_ID }}/${{ vars.prefix }}-${{ vars.PROJECT_ID }}/app
IMAGE_TAG: ${{ github.run_id }}

steps:
- name: Checkout Repo
Expand All @@ -32,8 +33,8 @@ jobs:
env:
GOOGLE_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
run: |
docker build -t "$IMAGE_NAME" .
docker push "$IMAGE_NAME"
docker build -t "$IMAGE_NAME:$IMAGE_TAG" .
docker push "$IMAGE_NAME:$IMAGE_TAG"
- name: Configure Kubernetes
run: gcloud container clusters get-credentials ${{ vars.prefix }}-${{ vars.PROJECT_ID }}-gke --region ${{ vars.ZONE }} --project ${{ vars.PROJECT_ID }}
Expand All @@ -47,7 +48,8 @@ jobs:
- name: Deploy deployment to GKE
working-directory: k8s/
run: |
export IMAGE_NAME=${{ vars.REGION }}-docker.pkg.dev/${{ vars.PROJECT_ID }}/${{ vars.prefix }}-${{ vars.PROJECT_ID }}/app:${{ github.run_id }}
export IMAGE_NAME=${{ vars.REGION }}-docker.pkg.dev/${{ vars.PROJECT_ID }}/${{ vars.prefix }}-${{ vars.PROJECT_ID }}/app
export IMAGE_TAG=${{ github.run_id }}
kubectl apply -f api-configmap.yaml
kubectl apply -f api-deployment.yaml
kubectl apply -f api-service.yaml
2 changes: 1 addition & 1 deletion k8s/api-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: api-container
image: ${IMAGE_NAME}
image: ${IMAGE_NAME}:${IMAGE_TAG}
workingDir: /usr/api
resources:
requests:
Expand Down

0 comments on commit 337c2de

Please sign in to comment.