Last active
May 20, 2020 14:22
-
-
Save paulonteri/bf4ac659f56339cbfa4e0155b85d4734 to your computer and use it in GitHub Desktop.
CI/CD - Deploy a Dockerised app to Google Cloud Run automatically with GitHub Actions
This file contains hidden or 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: Deploy a dockerised application to Google Cloud Run | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
deploy: | |
name: Deploy job | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v1 | |
- name: Build Docker image | |
run: | | |
docker build . --tag eu.gcr.io/${{ secrets.GCLOUD_PROJECT }}/${{ secrets.GCLOUD_APP_NAME }} | |
- name: Authenticate into Google Cloud Platform | |
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master | |
with: | |
service_account_email: ${{ secrets.GCLOUD_EMAIL }} | |
service_account_key: ${{ secrets.GCLOUD_AUTH }} | |
- name: Configure Docker to use Google Cloud Platform | |
run: "gcloud auth configure-docker --quiet" | |
- name: Push image to Google Cloud Container Registry | |
run: docker push eu.gcr.io/${{ secrets.GCLOUD_PROJECT }}/${{ secrets.GCLOUD_APP_NAME }} | |
- name: Install beta commands and deploy on cloud run | |
run: | | |
gcloud components install beta --quiet | |
gcloud beta run deploy ${{ secrets.GCLOUD_APP_NAME }} --quiet --image eu.gcr.io/${{ secrets.GCLOUD_PROJECT }}/${{ secrets.GCLOUD_APP_NAME }} --project ${{ secrets.GCLOUD_PROJECT }} --region ${{ secrets.GCLOUD_REGION }} --platform managed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment