@@ -110,14 +110,46 @@ jobs:
110110 include :
111111 - component : api
112112 build_args : " --target nilai --platform linux/amd64"
113+ - component : vllm
114+ model_to_cache : " openai/gpt-oss-20b"
113115 steps :
114116 - name : Checkout
115117 uses : actions/checkout@v2
116118
119+ - name : Set up Docker Buildx
120+ uses : docker/setup-buildx-action@v3
121+
122+ - name : Login to GitHub Container Registry
123+ uses : docker/login-action@v3
124+ with :
125+ registry : ghcr.io
126+ username : ${{ github.actor }}
127+ password : ${{ secrets.GITHUB_TOKEN }}
128+
117129 - name : Build ${{ matrix.component }} image
118130 run : |
119131 echo "Building ${{ matrix.component }} image..."
120- docker build -t nillion/nilai-${{ matrix.component }}:latest -f docker/${{ matrix.component }}.Dockerfile ${{ matrix.build_args || '' }} .
132+
133+ # Set cache and build args based on component
134+ CACHE_FROM="type=registry,ref=ghcr.io/${{ github.repository }}/nilai-${{ matrix.component }}:buildcache"
135+ CACHE_TO="type=registry,ref=ghcr.io/${{ github.repository }}/nilai-${{ matrix.component }}:buildcache,mode=max"
136+
137+ # Add model caching for vllm component
138+ EXTRA_BUILD_ARGS=""
139+ if [ "${{ matrix.component }}" = "vllm" ] && [ -n "${{ matrix.model_to_cache || '' }}" ]; then
140+ EXTRA_BUILD_ARGS="--build-arg MODEL_TO_CACHE=${{ matrix.model_to_cache }} --build-arg HF_TOKEN=${{ secrets.HF_TOKEN }}"
141+ fi
142+
143+ docker buildx build \
144+ -t nillion/nilai-${{ matrix.component }}:latest \
145+ -f docker/${{ matrix.component }}.Dockerfile \
146+ --cache-from=${CACHE_FROM} \
147+ --cache-to=${CACHE_TO} \
148+ --load \
149+ ${{ matrix.build_args || '' }} \
150+ ${EXTRA_BUILD_ARGS} \
151+ .
152+
121153 echo "✅ ${{ matrix.component }} build completed successfully"
122154
123155 e2e-tests :
0 commit comments