-
Notifications
You must be signed in to change notification settings - Fork 7
81 lines (67 loc) · 2.17 KB
/
pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Deploy to Azure Container Instances
run: |
az container create \
--name turbine-app \
--resource-group yke-rusticus-sandbox \
--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 yke-rusticus-sandbox
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