Skip to content

Commit 7e9217e

Browse files
committed
Add GitHub Actions workflow to build CPU AMD Docker image - Builds using Dockerfile-cpu-amd on GitHub runners - Pushes to GitHub Container Registry (ghcr.io) - Triggered on push to fix-dockerfile-issue branch - Much faster than local ARM64 Mac builds
1 parent c0a00f1 commit 7e9217e

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/build-cpu-amd.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Build CPU AMD Docker Image
2+
3+
on:
4+
push:
5+
branches: [ fix-dockerfile-issue ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}/text-embeddings-inference-cpu-amd
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Log in to Container Registry
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ${{ env.REGISTRY }}
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Extract metadata (tags, labels) for Docker
33+
id: meta
34+
uses: docker/metadata-action@v5
35+
with:
36+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
37+
tags: |
38+
type=ref,event=branch
39+
type=ref,event=pr
40+
type=sha,prefix={{branch}}-
41+
type=raw,value=latest,enable={{is_default_branch}}
42+
43+
- name: Set up Docker Buildx
44+
uses: docker/setup-buildx-action@v3
45+
46+
- name: Build and push Docker image
47+
uses: docker/build-push-action@v5
48+
with:
49+
context: .
50+
file: ./Dockerfile-cpu-amd
51+
push: true
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
platforms: linux/amd64
55+
cache-from: type=gha
56+
cache-to: type=gha,mode=max
57+
build-args: |
58+
GIT_SHA=${{ github.sha }}
59+
DOCKER_LABEL=${{ github.ref_name }}
60+
61+
- name: Output image details
62+
run: |
63+
echo "Image built and pushed successfully!"
64+
echo "Image tags:"
65+
echo "${{ steps.meta.outputs.tags }}"
66+
echo ""
67+
echo "To test this image on your AMD server:"
68+
echo "docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-${{ github.sha }}"

0 commit comments

Comments
 (0)