Skip to content

Commit cd3866f

Browse files
committed
use build image as artifact between stages
1 parent 7e224db commit cd3866f

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed

.github/workflows/ci-pipeline.yaml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,18 @@ jobs:
3030
- name: Generate tag
3131
id: meta
3232
run: echo "sha_tag=sha-${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
33-
- name: Build and tag Docker image
34-
uses: docker/build-push-action@v5
33+
34+
- name: Build Docker image
35+
run: docker build -f Containerfile -t test-image:${{ steps.meta.outputs.sha_tag }} .
36+
37+
- name: Save Docker image to tar
38+
run: docker save test-image:${{ steps.meta.outputs.sha_tag }} -o image.tar
39+
40+
- name: Upload image artifact
41+
uses: actions/upload-artifact@v4
3542
with:
36-
context: .
37-
file: ./Containerfile
38-
load: true
39-
tags: test-image:${{ steps.meta.outputs.sha_tag }}
43+
name: test-image
44+
path: image.tar
4045

4146
test:
4247
needs: [lint, build]
@@ -74,8 +79,19 @@ jobs:
7479

7580
steps:
7681
- uses: actions/checkout@v4
82+
83+
- name: Download image artifact
84+
uses: actions/download-artifact@v4
85+
with:
86+
name: test-image
87+
path: .
88+
89+
- name: Load Docker image
90+
run: docker load -i image.tar
91+
7792
- name: Wait for DB to start
7893
run: sleep 30
94+
7995
- name: Run embed job
8096
run: docker run --rm --network host test-image:${{ needs.build.outputs.image_tag }}
8197

@@ -85,12 +101,23 @@ jobs:
85101
needs: [lint, build, test]
86102
steps:
87103
- uses: actions/checkout@v4
104+
105+
- name: Download image artifact
106+
uses: actions/download-artifact@v4
107+
with:
108+
name: test-image
109+
path: .
110+
111+
- name: Load Docker image
112+
run: docker load -i image.tar
113+
88114
- name: Log in to Quay.io
89115
uses: docker/login-action@v3
90116
with:
91117
registry: quay.io
92118
username: ${{ secrets.QUAY_USERNAME }}
93119
password: ${{ secrets.QUAY_PASSWORD }}
120+
94121
- name: Tag and push image
95122
run: |
96123
docker tag test-image:${{ needs.build.outputs.image_tag }} quay.io/dminnear/vector-embedder:${{ needs.build.outputs.image_tag }}

0 commit comments

Comments
 (0)