Skip to content

Commit 351eede

Browse files
Dev NirwalDev Nirwal
authored andcommitted
Fixing CI/CD
1 parent 8a1fdd8 commit 351eede

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,43 @@ on:
88

99
env:
1010
# GHCR image name: ghcr.io/owner/repo-name
11-
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/simple-rag
11+
# We use a specific env variable to ensure the name is lowercase
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
1214

1315
jobs:
1416
build-and-push:
1517
runs-on: ubuntu-latest
1618
permissions:
1719
contents: read
18-
packages: write # Required for pushing to GHCR
20+
packages: write
1921
steps:
2022
- name: Check out the repo
2123
uses: actions/checkout@v4
2224

2325
- name: Log in to GitHub Container Registry
2426
uses: docker/login-action@v3
2527
with:
26-
registry: ghcr.io
28+
registry: ${{ env.REGISTRY }}
2729
username: ${{ github.actor }}
2830
password: ${{ secrets.GITHUB_TOKEN }}
2931

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=raw,value=latest
39+
type=sha
40+
3041
- name: Build and push Docker image
3142
uses: docker/build-push-action@v5
3243
with:
3344
context: .
3445
push: ${{ github.event_name != 'pull_request' }}
35-
tags: |
36-
${{ env.IMAGE_NAME }}:latest
37-
${{ env.IMAGE_NAME }}:${{ github.sha }}
38-
# Ensure image is lowered for GHCR if repository name contains uppercase
39-
labels: |
40-
org.opencontainers.image.source=https://github.com/${{ github.repository }}
46+
tags: ${{ steps.meta.outputs.tags }}
47+
labels: ${{ steps.meta.outputs.labels }}
4148

4249
# Optional job to automatically update kubernetes deployment.
4350
# This requires a kubernetes cluster setup and kubeconfig secret.

k8s/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ spec:
1616
spec:
1717
containers:
1818
- name: simple-rag
19-
# UPDATE: Replace <GITHUB_OWNER> with your GitHub username or organization name
20-
image: ghcr.io/<GITHUB_OWNER>/simple-rag:latest
19+
# Image name must be lowercase in GHCR
20+
image: ghcr.io/devn913/simple-rag:latest
2121
imagePullPolicy: Always
2222
ports:
2323
- containerPort: 8000

0 commit comments

Comments
 (0)