-
Notifications
You must be signed in to change notification settings - Fork 12
57 lines (48 loc) · 2 KB
/
base_image_build.yml
File metadata and controls
57 lines (48 loc) · 2 KB
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
# This YAML file is used to build and push a base Docker image with the necessary tools and dependencies for an ML project
# It contains a job that builds the Docker image and pushes it to GitHub Container Registry
name: Base Docker Image - Build and Push
on:
# Trigger the workflow manually
workflow_dispatch:
jobs:
build_and_push:
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout repository
# Check out the repository containing the Dockerfile and other necessary files
uses: actions/checkout@v6
- name: Log in to GitHub Container Registry
# Log in to GitHub Container Registry using the actor and a GitHub token
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
# Set up Docker Buildx for building multi-architecture images
uses: docker/setup-buildx-action@v4
- name: Format repo slug
# Format the repository slug to lowercase for use in the Docker image tags
id: repo_slug
run: echo "REPO_SLUG=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Build and push Docker image
# Build the Docker image using the Dockerfile in the `docker_base` directory and push it to GitHub Container Registry
uses: docker/build-push-action@v7
with:
context: ./docker_base
push: true
tags: ghcr.io/${{ env.REPO_SLUG }}/arm-mlops-docker-base:latest-${{ matrix.arch }}
# Use GitHub Actions cache to speed up the build process
cache-from: type=gha,scope=${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}