Skip to content

Commit efebf91

Browse files
committed
ci: build and push the cms mlflow ui image
1 parent 3a852a6 commit efebf91

File tree

2 files changed

+102
-3
lines changed

2 files changed

+102
-3
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: docker extra
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths:
7+
- 'docker/mlflow/**'
8+
pull_request:
9+
branches: [ master ]
10+
paths:
11+
- 'docker/mlflow/**'
12+
13+
env:
14+
REGISTRY: docker.io
15+
DOCKER_IMAGE_NAME: cogstacksystems/cogstack-mlflow-ui
16+
17+
jobs:
18+
lint:
19+
runs-on: ubuntu-latest
20+
container: hadolint/hadolint:latest-debian
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Lint
25+
run: hadolint --ignore DL3008 --ignore DL3013 --ignore DL3003 --ignore DL4006 docker/mlflow/**/Dockerfile*
26+
27+
build-and-push:
28+
needs: lint
29+
if: |
30+
github.repository == 'CogStack/CogStack-ModelServe' &&
31+
github.ref == 'refs/heads/master' &&
32+
github.event_name == 'push'
33+
runs-on: ubuntu-latest
34+
permissions:
35+
contents: read
36+
packages: write
37+
id-token: write
38+
attestations: write
39+
concurrency: build-and-push
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Set up QEMU
44+
uses: docker/setup-qemu-action@v3
45+
46+
- name: Set up Docker Buildx
47+
uses: docker/setup-buildx-action@v3
48+
49+
- name: Login to Docker Hub
50+
uses: docker/login-action@v3
51+
with:
52+
registry: ${{ env.REGISTRY }}
53+
username: ${{ secrets.DOCKERHUB_USERNAME }}
54+
password: ${{ secrets.DOCKERHUB_TOKEN }}
55+
56+
- name: Cache Docker layers
57+
uses: actions/cache@v4
58+
with:
59+
path: /tmp/.buildx-cache
60+
key: ${{ runner.os }}-buildx-${{ github.sha }}
61+
restore-keys: |
62+
${{ runner.os }}-buildx-
63+
64+
- name: Build and push MLflow UI
65+
uses: docker/build-push-action@v6
66+
id: build_and_push_mlflow_ui
67+
with:
68+
platforms: linux/amd64,linux/arm64
69+
context: .
70+
file: docker/mlflow/server/Dockerfile
71+
push: true
72+
tags: |
73+
${{ env.REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:dev
74+
cache-from: type=local,src=/tmp/.buildx-cache
75+
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
76+
77+
- name: Attest image artifacts
78+
uses: actions/attest-build-provenance@v2
79+
id: attest
80+
with:
81+
subject-name: ${{ env.REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
82+
subject-digest: ${{ steps.build_and_push_mlflow_ui.outputs.digest }}
83+
push-to-registry: true

.github/workflows/docker.yaml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
branches: [ master ]
88

99
env:
10+
REGISTRY: docker.io
1011
DOCKER_IMAGE_NAME: cogstacksystems/cogstack-modelserve
1112

1213
jobs:
@@ -17,7 +18,7 @@ jobs:
1718
- uses: actions/checkout@v4
1819

1920
- name: Lint
20-
run: hadolint --ignore DL3008 --ignore DL3013 --ignore DL3003 --ignore DL4006 docker/Dockerfile* docker/**/Dockerfile* docker/mlflow/**/Dockerfile*
21+
run: hadolint --ignore DL3008 --ignore DL3013 --ignore DL3003 --ignore DL4006 docker/Dockerfile* docker/**/Dockerfile*
2122

2223
build-and-push:
2324
needs: lint
@@ -26,6 +27,11 @@ jobs:
2627
github.ref == 'refs/heads/master' &&
2728
github.event_name == 'push'
2829
runs-on: ubuntu-latest
30+
permissions:
31+
contents: read
32+
packages: write
33+
id-token: write
34+
attestations: write
2935
concurrency: build-and-push
3036
steps:
3137
- uses: actions/checkout@v4
@@ -39,6 +45,7 @@ jobs:
3945
- name: Login to Docker Hub
4046
uses: docker/login-action@v3
4147
with:
48+
registry: ${{ env.REGISTRY }}
4249
username: ${{ secrets.DOCKERHUB_USERNAME }}
4350
password: ${{ secrets.DOCKERHUB_TOKEN }}
4451

@@ -50,14 +57,23 @@ jobs:
5057
restore-keys: |
5158
${{ runner.os }}-buildx-
5259
53-
- name: Build and push
60+
- name: Build and push CMS
5461
uses: docker/build-push-action@v6
62+
id: build_and_push_cms
5563
with:
5664
platforms: linux/amd64,linux/arm64
5765
context: .
5866
file: docker/Dockerfile
5967
push: true
6068
tags: |
61-
${{ env.DOCKER_IMAGE_NAME }}:dev
69+
${{ env.REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:dev
6270
cache-from: type=local,src=/tmp/.buildx-cache
6371
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
72+
73+
- name: Attest image artifacts
74+
uses: actions/attest-build-provenance@v2
75+
id: attest
76+
with:
77+
subject-name: ${{ env.REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
78+
subject-digest: ${{ steps.build_and_push_cms.outputs.digest }}
79+
push-to-registry: true

0 commit comments

Comments
 (0)