Skip to content

Commit fd0a941

Browse files
authored
Merge pull request #113 from NillionNetwork/feat/add_cd_pipeline
chore: add CD pipeline for nilAI Docker images
2 parents 9cbac64 + af4b140 commit fd0a941

File tree

4 files changed

+65
-7
lines changed

4 files changed

+65
-7
lines changed
Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
name: Python Tests
1+
name: CI/CD
22

33
on:
44
push:
55
branches: [ "main" ]
66
pull_request:
7-
branches: [ "**"] # Adjust branches as needed
7+
branches: [ "**" ] # Adjust branches as needed
8+
release:
9+
types: [published]
10+
11+
permissions:
12+
id-token: write # Required for OIDC
13+
contents: read # Required for checkout
814

915
jobs:
1016
test:
@@ -45,6 +51,7 @@ jobs:
4551
start-runner:
4652
name: Start self-hosted EC2 runner
4753
runs-on: ubuntu-24.04
54+
needs: test
4855
outputs:
4956
label: ${{ steps.start-ec2-runner.outputs.label }}
5057
ec2-instances-ids: ${{ steps.start-ec2-runner.outputs.ec2-instances-ids }}
@@ -168,3 +175,50 @@ jobs:
168175
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
169176
label: ${{ needs.start-runner.outputs.label }}
170177
ec2-instances-ids: ${{ needs.start-runner.outputs.ec2-instances-ids }}
178+
179+
deploy-images:
180+
name: Publish ${{ matrix.component }} to ECR
181+
needs: e2e-tests
182+
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'release'
183+
runs-on: ubuntu-latest
184+
strategy:
185+
matrix:
186+
include:
187+
- component: vllm
188+
docker_build_extra_args: ""
189+
- component: attestation
190+
docker_build_extra_args: ""
191+
- component: api
192+
docker_build_extra_args: "--target nilai --platform linux/amd64"
193+
steps:
194+
- uses: actions/checkout@v4
195+
196+
- uses: aws-actions/configure-aws-credentials@v4
197+
with:
198+
role-to-assume: "arn:aws:iam::054037142884:role/nilai-github"
199+
aws-region: "us-east-1"
200+
201+
- uses: aws-actions/amazon-ecr-login@v2
202+
id: login-ecr
203+
with:
204+
registry-type: public
205+
206+
- uses: docker/setup-buildx-action@v3
207+
208+
- name: Build and push ${{ matrix.component }} image
209+
env:
210+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
211+
ECR_REGISTRY_ALIAS: k5d9x2g2
212+
ECR_REPOSITORY: nilai-${{ matrix.component }}
213+
IMAGE_TAG: ${{ github.event_name == 'release' && github.ref_name || github.sha }}
214+
run: |
215+
ECR_REGISTRY_URL="${ECR_REGISTRY}/${ECR_REGISTRY_ALIAS}/${ECR_REPOSITORY}"
216+
217+
docker build \
218+
--push \
219+
-f docker/${{ matrix.component }}.Dockerfile \
220+
-t ${ECR_REGISTRY_URL}:${IMAGE_TAG} \
221+
${{ matrix.docker_build_extra_args }} \
222+
.
223+
224+
echo "Pushed ${{ matrix.component }} image: ${ECR_REGISTRY_URL}:${IMAGE_TAG}" >> $GITHUB_STEP_SUMMARY

nilai-api/pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,6 @@ build-backend = "hatchling.build"
4343
[tool.uv.sources]
4444
nilai-common = { workspace = true }
4545
nuc-helpers = { workspace = true }
46-
nuc = { git = "https://github.com/NillionNetwork/nuc-py.git", tag = "54c7171e0e30fc9a68ba9e307bb6e92a0690f4d8" }
46+
47+
nuc = { git = "https://github.com/NillionNetwork/nuc-py.git", rev = "4922b5e9354e611cc31322d681eb29da05be584e" }
48+

nilai-auth/nuc-helpers/pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ requires = ["hatchling"]
2020
build-backend = "hatchling.build"
2121

2222
[tool.uv.sources]
23-
nuc = { git = "https://github.com/NillionNetwork/nuc-py.git", tag = "54c7171e0e30fc9a68ba9e307bb6e92a0690f4d8" }
23+
24+
nuc = { git = "https://github.com/NillionNetwork/nuc-py.git", rev = "4922b5e9354e611cc31322d681eb29da05be584e" }
25+

uv.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)