Skip to content

Commit 56ef216

Browse files
committed
initial commit
1 parent 81da2eb commit 56ef216

4 files changed

Lines changed: 110 additions & 0 deletions

File tree

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = false
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.github/workflows/publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
15+
- name: Extract Version from Dockerfile
16+
id: docker_meta
17+
run: |
18+
VERSION_LABEL=$(grep 'org.opencontainers.image.version' ./Dockerfile | cut -d '"' -f 2)
19+
echo "::set-output name=VERSION::$VERSION_LABEL"
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v1
23+
24+
- name: Log in to GitHub Container Registry
25+
uses: docker/login-action@v1
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Build and push Docker image
32+
uses: docker/build-push-action@v2
33+
with:
34+
context: .
35+
file: ./Dockerfile
36+
push: true
37+
tags: ghcr.io/${{ github.repository }}:${{ steps.docker_meta.outputs.VERSION }}

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
ARG PG_MAJOR=16
2+
FROM postgis/postgis:$PG_MAJOR-3.4
3+
ARG PG_MAJOR
4+
5+
LABEL org.opencontainers.image.title="postgis-vector" \
6+
org.opencontainers.image.description="postgresql+postgis container with pgvector added" \
7+
org.opencontainers.image.vendor="@gvkhna" \
8+
org.opencontainers.image.authors="Gaurav Khanna <gaurav@gvkhna.com>" \
9+
org.opencontainers.image.version="16-3.4" \
10+
org.opencontainers.image.licenses="MIT" \
11+
org.opencontainers.image.url="https://github.com/gvkhna/postgis-vector" \
12+
org.opencontainers.image.source="https://github.com/gvkhna/postgis-vector"
13+
14+
RUN apt-get update \
15+
&& apt-mark hold locales \
16+
&& apt-get install -qq -y --no-install-recommends \
17+
build-essential \
18+
pgxnclient \
19+
postgresql-server-dev-$PG_MAJOR \
20+
&& pgxn install 'pg_uuidv7=1.5.0' \
21+
&& pgxn install 'vector=0.6.2' \
22+
&& apt-get remove -y build-essential postgresql-server-dev-$PG_MAJOR \
23+
&& apt-get autoremove -y \
24+
&& apt-get clean \
25+
&& apt-mark unhold locales \
26+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Deploy
2+
3+
```
4+
ghcr.io/gvkhna/postgis-vector:latest
5+
```
6+
7+
# After Deploy Initialize Extensions
8+
9+
```sh
10+
$ su - postgres
11+
$ psql
12+
postgres=# CREATE EXTENSION vector;
13+
postgres=# CREATE EXTENSION fuzzystrmatch;
14+
postgres=# CREATE EXTENSION pg_trgm;
15+
postgres=# CREATE EXTENSION pg_uuidv7;
16+
17+
# to verify extensions installed
18+
postgres=# \dx
19+
```
20+
21+
## Build
22+
23+
```sh
24+
podman build -t postgis-vector .
25+
```
26+
27+
## Minimal Run
28+
29+
```
30+
podman run -it --name postgis-vector -e POSTGRES_PASSWORD=mysecretpassword -d postgis-vector
31+
podman exec -it postgis-vector bash
32+
```

0 commit comments

Comments
 (0)