-
Notifications
You must be signed in to change notification settings - Fork 16
151 lines (133 loc) · 5.17 KB
/
build_push_docker_hub.yaml
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Build and Push to Docker Hub
on:
push:
branches:
- master
jobs:
shared_steps: # Job for shared steps
name: Prepare for Docker builds
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Upload repository as artifact
uses: actions/upload-artifact@v3
with:
name: repository
path: . # Upload the entire current directory
build_and_push_images: # Job for building and pushing the images
name: Build and Push Images
runs-on: ubuntu-latest
needs: shared_steps # Dependency on the shared steps
strategy:
matrix:
image: [
{ name: web-ui, context: ./services/web-ui, file: ./services/web-ui/Dockerfile },
{ name: training-service, context: ./services/training-service, file: ./services/training-service/Dockerfile },
{ name: data-producer, context: ./services/data-producer, file: ./services/data-producer/Dockerfile },
{ name: mlflow, context: ./services/mlflow, file: ./services/mlflow/Dockerfile },
{ name: airflow-spark, context: ./services/airflow, file: ./services/airflow/Dockerfile },
{ name: forecast-service, context: ./services/forecast-service, file: ./services/forecast-service/Dockerfile }
]
steps:
- name: Download repository artifact
uses: actions/download-artifact@v3
with:
name: repository
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for ${{ matrix.image.name }} Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ariya23156/sfmlops-${{ matrix.image.name }}
- name: Build and push ${{ matrix.image.name }} Docker image
uses: docker/build-push-action@v3
with:
context: ${{ matrix.image.context }}
file: ${{ matrix.image.file }}
platforms: linux/amd64,linux/arm64
push: true
tags: ariya23156/sfmlops-${{ matrix.image.name }}:latest
labels: ${{ steps.meta.outputs.labels }}
# Hardcoded all build-args here, couldn't find a proper way
# to put this into matrix
build-args: |
AIRFLOW_HOME=/opt/airflow
build_and_push_ray_arm64: # Job for building and pushing the images
name: Build and Push Ray arm64 Image
runs-on: ubuntu-latest
needs: shared_steps # Dependency on the shared steps
steps:
- name: Download repository artifact
uses: actions/download-artifact@v3
with:
name: repository
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for ray Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ariya23156/sfmlops-ray
- name: Build and push ray Docker image
uses: docker/build-push-action@v3
with:
context: ./services/ray
file: ./services/ray/Dockerfile
platforms: linux/arm64
push: true
tags: ariya23156/sfmlops-ray:latest-arm64
labels: ${{ steps.meta.outputs.labels }}
# Hardcoded all build-args here, couldn't find a proper way
# to put this into matrix
## for amd64 (x86_64) please leave ARCH_TRAILING_IMG_NAME empty like
## ARCH_TRAILING_IMG_NAME=
build-args: |
MLFLOW_ARTIFACT_ROOT=/storage/mlruns
ARCH_TRAILING_IMG_NAME=-aarch64
build_and_push_ray_amd64: # Job for building and pushing the images
name: Build and Push Ray amd64 Image
runs-on: ubuntu-latest
needs: shared_steps # Dependency on the shared steps
steps:
- name: Download repository artifact
uses: actions/download-artifact@v3
with:
name: repository
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for ray Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ariya23156/sfmlops-ray
- name: Build and push ray Docker image
uses: docker/build-push-action@v3
with:
context: ./services/ray
file: ./services/ray/Dockerfile
platforms: linux/amd64
push: true
tags: ariya23156/sfmlops-ray:latest-amd64
labels: ${{ steps.meta.outputs.labels }}
# Hardcoded all build-args here, couldn't find a proper way
# to put this into matrix
build-args: |
MLFLOW_ARTIFACT_ROOT=/storage/mlruns
ARCH_TRAILING_IMG_NAME=