Doc is done and finalized #34
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: 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 Ray image for arm64 platform | |
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 Ray image for amd64 platform | |
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= |