feat: PostgreSQL image with TimescaleDB, VectorChord, pgvector
Some checks failed
🚀 Docker Build and Push / build-and-push (15) (push) Successful in 7m47s
🚀 Docker Build and Push / build-and-push (16) (push) Successful in 5m42s
🚀 Docker Build and Push / build-and-push (18) (push) Has been cancelled
🚀 Docker Build and Push / build-and-push (17) (push) Has been cancelled
Some checks failed
🚀 Docker Build and Push / build-and-push (15) (push) Successful in 7m47s
🚀 Docker Build and Push / build-and-push (16) (push) Successful in 5m42s
🚀 Docker Build and Push / build-and-push (18) (push) Has been cancelled
🚀 Docker Build and Push / build-and-push (17) (push) Has been cancelled
- Multi-stage Dockerfile for optimized image size (676MB vs 2GB) - Support for PostgreSQL 15, 16, 17, 18 - TimescaleDB 2.24.0, VectorChord 1.0.0, pgvector 0.8.1 - Auto-creation of extensions on first startup - CI/CD with tests for all versions - OCI labels and healthcheck included
This commit is contained in:
109
.gitea/workflows/docker-build.yml
Normal file
109
.gitea/workflows/docker-build.yml
Normal file
@@ -0,0 +1,109 @@
|
||||
name: 🚀 Docker Build and Push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
pg_version: [15, 16, 17, 18]
|
||||
steps:
|
||||
- name: 📥 Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 🛠️ Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: 🔐 Login to Gitea Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.killinger.fr
|
||||
username: maxime.killinger
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
|
||||
- name: 📦 Build Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
load: true
|
||||
build-args: |
|
||||
PG_VERSION=${{ matrix.pg_version }}
|
||||
tags: |
|
||||
postgres-ts-vectors:pg${{ matrix.pg_version }}-test
|
||||
|
||||
- name: 🧪 Test image - Start container
|
||||
run: |
|
||||
docker run -d --name test-pg${{ matrix.pg_version }} \
|
||||
-e POSTGRES_PASSWORD=testpass \
|
||||
postgres-ts-vectors:pg${{ matrix.pg_version }}-test
|
||||
|
||||
# Wait for PostgreSQL to be ready
|
||||
echo "Waiting for PostgreSQL to start..."
|
||||
for i in {1..30}; do
|
||||
if docker exec test-pg${{ matrix.pg_version }} pg_isready -U postgres > /dev/null 2>&1; then
|
||||
echo "PostgreSQL is ready!"
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
- name: 🧪 Test image - Verify extensions
|
||||
run: |
|
||||
# Wait a bit more for init scripts to complete
|
||||
sleep 5
|
||||
|
||||
# Check extensions are installed
|
||||
RESULT=$(docker exec test-pg${{ matrix.pg_version }} psql -U postgres -t -c \
|
||||
"SELECT count(*) FROM pg_extension WHERE extname IN ('timescaledb', 'vector', 'vchord');")
|
||||
|
||||
EXTENSIONS=$(echo $RESULT | tr -d ' ')
|
||||
echo "Found $EXTENSIONS extensions"
|
||||
|
||||
if [ "$EXTENSIONS" -eq "3" ]; then
|
||||
echo "✅ All 3 extensions are installed!"
|
||||
else
|
||||
echo "❌ Expected 3 extensions, found $EXTENSIONS"
|
||||
docker exec test-pg${{ matrix.pg_version }} psql -U postgres -c \
|
||||
"SELECT extname, extversion FROM pg_extension;"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Show extension versions
|
||||
docker exec test-pg${{ matrix.pg_version }} psql -U postgres -c \
|
||||
"SELECT extname, extversion FROM pg_extension WHERE extname IN ('timescaledb', 'vector', 'vchord');"
|
||||
|
||||
- name: 🧹 Cleanup test container
|
||||
if: always()
|
||||
run: docker rm -f test-pg${{ matrix.pg_version }} || true
|
||||
|
||||
- name: 🚀 Push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
build-args: |
|
||||
PG_VERSION=${{ matrix.pg_version }}
|
||||
tags: |
|
||||
gitea.killinger.fr/maxime.killinger/postgres-ts-vectors:pg${{ matrix.pg_version }}
|
||||
|
||||
- name: 🏷️ Tag latest (PG18 only)
|
||||
if: matrix.pg_version == 18
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
build-args: |
|
||||
PG_VERSION=18
|
||||
tags: |
|
||||
gitea.killinger.fr/maxime.killinger/postgres-ts-vectors:latest
|
||||
|
||||
- name: 🔔 Trigger Watchtower
|
||||
if: matrix.pg_version == 18
|
||||
env:
|
||||
TOKEN: ${{ secrets.WATCHTOWER_TOKEN }}
|
||||
run: |
|
||||
curl -X GET -H "Authorization: Bearer $TOKEN" http://192.168.1.118:3026/v1/update
|
||||
Reference in New Issue
Block a user