Skip to content

Commit 850c018

Browse files
committed
build image
1 parent 5d1c423 commit 850c018

3 files changed

Lines changed: 70 additions & 0 deletions

File tree

‎.github/workflows/build-image.yml‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: build-image
2+
3+
# Build the service container image and push it to GHCR. The k8s-manifests
4+
# repo pins the Deployment to an immutable sha-<commit> tag produced here
5+
# (Argo Image Updater bumps kustomization newTag), so a deploy is a manifest
6+
# bump in that repo — never a moving :latest in-cluster.
7+
#
8+
# Builds the CPU/ONNX image for now. To move to GPU, switch `file` to
9+
# dockerfiles/Dockerfile_trt — note the nvcr TensorRT base is ~10GB, which
10+
# needs a free-disk-space step and overflows the 10GB GHA layer cache.
11+
on:
12+
push:
13+
branches: [master]
14+
tags: ['v*']
15+
workflow_dispatch:
16+
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- uses: docker/setup-buildx-action@v3
28+
29+
- name: Log in to GHCR
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: ghcr.io/moderation-api/insightface-rest
40+
tags: |
41+
type=sha,format=long
42+
type=ref,event=tag
43+
type=raw,value=latest,enable={{is_default_branch}}
44+
45+
- name: Build and push
46+
uses: docker/build-push-action@v6
47+
with:
48+
context: .
49+
file: dockerfiles/Dockerfile_cpu
50+
platforms: linux/amd64
51+
push: true
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max

‎dockerfiles/Dockerfile_cpu‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ WORKDIR /app
2525
COPY if_rest /app/if_rest
2626
COPY entrypoint.sh /app/entrypoint.sh
2727

28+
# Bake in the model manifest and the /health self-check images so the image
29+
# is self-contained for k8s. Compose bind-mounts ../models over /models, so
30+
# this stays compatible with local development; in-cluster, only the model
31+
# cache dirs are volume-mounted (PVC) and models.json is read from the image.
32+
COPY models/models.json /models/models.json
33+
COPY misc/test_images /images/test_images
34+
2835

2936
ENTRYPOINT [ "bash" ]
3037
CMD ["entrypoint.sh"]

‎dockerfiles/Dockerfile_trt‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,13 @@ WORKDIR /app
2424
COPY if_rest /app/if_rest
2525
COPY entrypoint.sh /app/entrypoint.sh
2626

27+
# Bake in the model manifest and the /health self-check images so the image
28+
# is self-contained for k8s. Compose bind-mounts ../models over /models, so
29+
# this stays compatible with local development; in-cluster, only the onnx/
30+
# and trt-engines/ cache dirs are volume-mounted (PVC) and models.json is
31+
# read from the image.
32+
COPY models/models.json /models/models.json
33+
COPY misc/test_images /images/test_images
34+
2735
ENTRYPOINT [ "bash" ]
2836
CMD ["entrypoint.sh"]

0 commit comments

Comments
 (0)