Skip to content

Build, Push and Deploy #10

Build, Push and Deploy

Build, Push and Deploy #10

Workflow file for this run

name: Build, Push and Deploy
on:
pull_request:
types:
- closed
workflow_dispatch:
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1
# - name: Login to Docker Hub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_PASSWORD }}
# - name: Build and push Docker image
# uses: docker/build-push-action@v2
# with:
# context: .
# push: true
# tags: ${{ secrets.DOCKERHUB_USERNAME }}/turbine-image:latest
deploy_azure:
needs: build_and_push
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
- name: Deploy to Azure Container Instances
run: |
az container create \
--name turbine-app \
--resource-group mlops-tutorial \
--image ${{ secrets.DOCKERHUB_USERNAME }}/turbine-image:latest \
--dns-name-label turbine-app \
--ports 8080 \
--ip-address public || \
az container restart \
--name turbine-app \
--resource-group mlops-tutorial
deploy_gcp:
needs: build_and_push
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Google Cloud SDK
uses: google-github-actions/[email protected]
with:
project_id: mlops-workshop-project
service_account_key: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
export_default_credentials: true
- name: Deploy to Google Cloud Run
run: |
gcloud run deploy turbine-app \
--image docker.io/${{ secrets.DOCKERHUB_USERNAME }}/turbine-image:latest \
--platform managed \
--region europe-west1 \
--allow-unauthenticated \
--project mlops-workshop-project