Skip to content

Commit 8429798

Browse files
setup on-pr action
1 parent ecaf34a commit 8429798

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

.github/workflows/_docker.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: ~ build
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
GITHUB_TOKEN:
7+
required: true
8+
inputs:
9+
tag:
10+
type: string
11+
required: true
12+
13+
jobs:
14+
builder:
15+
name: builder image
16+
runs-on: self-hosted
17+
steps:
18+
- name: 'Checkout GitHub Action'
19+
uses: actions/checkout@main
20+
21+
- name: 'Login to GitHub Container Registry'
22+
uses: docker/login-action@v1
23+
with:
24+
registry: ghcr.io
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: 'Build Postgres Image'
29+
run: |
30+
docker build \
31+
-f Dockerfile.postgres \
32+
--platform linux/amd64 \
33+
-t ghcr.io/trycompa/postgres:${{ inputs.tag }} .
34+
docker push ghcr.io/trycompa/postgres:${{ inputs.tag }}

.github/workflows/pull_request.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: pr
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
docker:
9+
name: docker
10+
uses: ./.github/workflows/_docker.yml
11+
with:
12+
tag: 14-${{ github.sha }}
13+
secrets:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Dockerfile.postgres

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Same major version as production
2+
FROM imresamu/postgis:14-3.4
3+
LABEL org.opencontainers.image.source="https://github.com/trycompa/docker-postgres"
4+
5+
6+
# Install build dependencies and pgvector
7+
RUN apt-get update && apt-get install -y \
8+
build-essential \
9+
git \
10+
postgresql-server-dev-14 \
11+
&& git clone --branch v0.5.1 https://github.com/pgvector/pgvector.git \
12+
&& cd pgvector \
13+
&& make \
14+
&& make install \
15+
&& cd .. \
16+
&& rm -rf pgvector \
17+
&& apt-get remove -y build-essential git postgresql-server-dev-14 \
18+
&& apt-get autoremove -y \
19+
&& rm -rf /var/lib/apt/lists/*
20+
21+
# log all queries
22+
CMD ["postgres", "-c", "log_statement=all"]

0 commit comments

Comments
 (0)