Skip to content

[๐Ÿš€ deploy] Github Actions CI/CD ํŒŒ์ดํ”„๋ผ์ธ ๊ตฌ์ถ• #2

[๐Ÿš€ deploy] Github Actions CI/CD ํŒŒ์ดํ”„๋ผ์ธ ๊ตฌ์ถ•

[๐Ÿš€ deploy] Github Actions CI/CD ํŒŒ์ดํ”„๋ผ์ธ ๊ตฌ์ถ• #2

Workflow file for this run

name: Deploy to Cloud Run with Docker
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
deploy:
name: Build & Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'pnpm'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Vite app
run: pnpm run build
- name: Set up Docker
uses: docker/setup-buildx-action@v2
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Set up gcloud CLI
uses: google-github-actions/setup-gcloud@v2
- name: Configure Docker for GCR
run: gcloud auth configure-docker --quiet
- name: Build and Push Docker image
run: |
docker buildx build --platform linux/amd64 -f dockerfile_frontend -t gcr.io/${{ secrets.GCP_PROJECT }}/${{ secrets.GCP_RUN_SERVICE }} --push .
- name: Deploy to Cloud Run
run: |
gcloud run deploy ${{ secrets.GCP_RUN_SERVICE }} \
--image gcr.io/${{ secrets.GCP_PROJECT }}/${{ secrets.GCP_RUN_SERVICE }} \
--region ${{ secrets.GCP_REGION }} \
--platform managed \
--allow-unauthenticated