Changed buildargs format #18
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: Publish Docker images | ||
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 Image | ||
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, buildargs: "" }, | ||
{ name: training-service, context: ./services/training-service, file: ./services/training-service/Dockerfile, buildargs: "" }, | ||
{ name: data-producer, context: ./services/data-producer, file: ./services/data-producer/Dockerfile, buildargs: "" }, | ||
{ name: mlflow, context: ./services/mlflow, file: ./services/mlflow/Dockerfile, buildargs: "" }, | ||
{ name: airflow-spark, context: ./services/airflow, file: ./services/airflow/Dockerfile, | ||
buildargs: | | ||
AIRFLOW_HOME=/opt/airflow | ||
}, | ||
# for amd64 (x86_64) please leave ARCH_TRAILING_IMG_NAME empty | ||
{ name: ray, context: ./services/ray, file: ./services/ray/Dockerfile, | ||
buildargs: | | ||
MLFLOW_ARTIFACT_ROOT=/storage/mlruns | ||
ARCH_TRAILING_IMG_NAME="-aarch64" | ||
} | ||
] | ||
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/arm64 | ||
push: true | ||
tags: ariya23156/sfmlops-${{ matrix.image.name }}:latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: ${{ matrix.image.buildargs }} |