Skip to content

Commit 742de80

Browse files
committed
only spin up db container for db used in each job
1 parent cd3866f commit 742de80

File tree

1 file changed

+50
-35
lines changed

1 file changed

+50
-35
lines changed

.github/workflows/ci-pipeline.yaml

Lines changed: 50 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,20 @@ jobs:
2727
image_tag: ${{ steps.meta.outputs.sha_tag }}
2828
steps:
2929
- uses: actions/checkout@v4
30+
3031
- name: Generate tag
3132
id: meta
3233
run: echo "sha_tag=sha-${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
3334

3435
- name: Build Docker image
35-
run: docker build -f Containerfile -t test-image:${{ steps.meta.outputs.sha_tag }} .
36+
uses: docker/build-push-action@v5
37+
with:
38+
context: .
39+
file: ./Containerfile
40+
load: true
41+
tags: test-image:${{ steps.meta.outputs.sha_tag }}
3642

37-
- name: Save Docker image to tar
43+
- name: Save image as artifact
3844
run: docker save test-image:${{ steps.meta.outputs.sha_tag }} -o image.tar
3945

4046
- name: Upload image artifact
@@ -50,32 +56,6 @@ jobs:
5056
fail-fast: false
5157
matrix:
5258
db: [pgvector, redis, elasticsearch, qdrant]
53-
services:
54-
pgvector:
55-
image: ankane/pgvector
56-
ports:
57-
- 5432:5432
58-
env:
59-
POSTGRES_USER: user
60-
POSTGRES_PASSWORD: pass
61-
POSTGRES_DB: mydb
62-
redis:
63-
image: redis/redis-stack-server:6.2.6-v19
64-
ports:
65-
- 6379:6379
66-
elasticsearch:
67-
image: elasticsearch:8.11.1
68-
ports:
69-
- 9200:9200
70-
env:
71-
discovery.type: single-node
72-
xpack.security.enabled: true
73-
ELASTIC_PASSWORD: changeme
74-
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
75-
qdrant:
76-
image: qdrant/qdrant
77-
ports:
78-
- 6333:6333
7959

8060
steps:
8161
- uses: actions/checkout@v4
@@ -89,6 +69,41 @@ jobs:
8969
- name: Load Docker image
9070
run: docker load -i image.tar
9171

72+
- name: Start PGVector
73+
if: matrix.db == 'pgvector'
74+
run: |
75+
docker run -d --name pgvector-test \
76+
-e POSTGRES_USER=user \
77+
-e POSTGRES_PASSWORD=pass \
78+
-e POSTGRES_DB=mydb \
79+
-p 5432:5432 \
80+
ankane/pgvector
81+
82+
- name: Start Redis
83+
if: matrix.db == 'redis'
84+
run: |
85+
docker run -d --name redis-test \
86+
-p 6379:6379 \
87+
redis/redis-stack-server:6.2.6-v19
88+
89+
- name: Start Elasticsearch
90+
if: matrix.db == 'elasticsearch'
91+
run: |
92+
docker run -d --name es-test \
93+
-e "discovery.type=single-node" \
94+
-e "xpack.security.enabled=true" \
95+
-e "ELASTIC_PASSWORD=changeme" \
96+
-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
97+
-p 9200:9200 \
98+
elasticsearch:8.11.1
99+
100+
- name: Start Qdrant
101+
if: matrix.db == 'qdrant'
102+
run: |
103+
docker run -d --name qdrant-test \
104+
-p 6333:6333 \
105+
qdrant/qdrant
106+
92107
- name: Wait for DB to start
93108
run: sleep 30
94109

@@ -102,6 +117,13 @@ jobs:
102117
steps:
103118
- uses: actions/checkout@v4
104119

120+
- name: Log in to Quay.io
121+
uses: docker/login-action@v3
122+
with:
123+
registry: quay.io
124+
username: ${{ secrets.QUAY_USERNAME }}
125+
password: ${{ secrets.QUAY_PASSWORD }}
126+
105127
- name: Download image artifact
106128
uses: actions/download-artifact@v4
107129
with:
@@ -111,13 +133,6 @@ jobs:
111133
- name: Load Docker image
112134
run: docker load -i image.tar
113135

114-
- name: Log in to Quay.io
115-
uses: docker/login-action@v3
116-
with:
117-
registry: quay.io
118-
username: ${{ secrets.QUAY_USERNAME }}
119-
password: ${{ secrets.QUAY_PASSWORD }}
120-
121136
- name: Tag and push image
122137
run: |
123138
docker tag test-image:${{ needs.build.outputs.image_tag }} quay.io/dminnear/vector-embedder:${{ needs.build.outputs.image_tag }}

0 commit comments

Comments
 (0)