Merge pull request #5 from nronzel/DockerBuild #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cd | |
on: | |
push: | |
branches: [main] | |
jobs: | |
deploy: | |
name: deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Build app | |
run: ./scripts/buildprod.sh | |
- id: "auth" | |
uses: "google-github-actions/auth@v1" | |
with: | |
credentials_json: "${{ secrets.GCP_CREDENTIALS }}" | |
- name: Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
- name: Build & Push Docker Image | |
run: "gcloud builds submit --tag us-east1-docker.pkg.dev/xoracle/xoracle-repo/xoracle:latest ." | |
- name: Deploy to Cloud Run | |
run: "gcloud run deploy xoracle --image us-east1-docker.pkg.dev/xoracle/xoracle-repo/xoracle:latest --region us-east1 --allow-unauthenticated --project xoracle --max-instances=4" | |
- name: Log into DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: sutats/xoracle:latest |