All checks were successful
🚀 Docker Build and Push / build-and-push (15) (push) Successful in 5m44s
🚀 Docker Build and Push / build-and-push (16) (push) Successful in 5m33s
🚀 Docker Build and Push / build-and-push (18) (push) Successful in 6m7s
🚀 Docker Build and Push / build-and-push (17) (push) Successful in 7m54s
- 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
105 lines
3.2 KiB
YAML
105 lines
3.2 KiB
YAML
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
|
|
|
|
|