Files
postgres-ts-vectors/.gitea/workflows/docker-build.yml
Maxime Killinger f0d5f4870e
All checks were successful
🚀 Docker Build and Push / build-and-push (15) (push) Successful in 4m44s
🚀 Docker Build and Push / build-and-push (16) (push) Successful in 4m48s
🚀 Docker Build and Push / build-and-push (17) (push) Successful in 4m47s
🚀 Docker Build and Push / build-and-push (18) (push) Successful in 4m36s
fix(docker): resolve permission denied error for PG18+ volume mounts
PostgreSQL 18+ Docker images changed the data directory structure to use
versioned subdirectories (e.g., /var/lib/postgresql/18/main) instead of
the traditional /var/lib/postgresql/data path.

Changes:
- Dockerfile: Add mkdir and chown to ensure /var/lib/postgresql has
  correct permissions for the postgres user before volume mount
- README.md: Update Quick Start with volume mount example
- README.md: Add 'Data Persistence' section explaining PG18+ requirements

This fixes the 'mkdir: cannot create directory: Permission denied' error
that occurred when mounting volumes at /var/lib/postgresql.

See: https://github.com/docker-library/postgres/pull/1259
2025-12-25 17:32:43 +01:00

104 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: https://github.com/actions/checkout@v4
- name: 🛠️ Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v3
- name: 🔐 Login to Gitea Registry
uses: https://github.com/docker/login-action@v3
with:
registry: gitea.killinger.fr
username: maxime.killinger
password: ${{ secrets.DOCKER_TOKEN }}
- name: 📦 Build Docker image
uses: https://github.com/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: ⚙️ Setup Tests
run: |
# Wait for valid startup
sleep 10
docker cp tests/ test-pg${{ matrix.pg_version }}:/tmp/tests/
- name: "🧪 Test 1: Configuration"
run: docker exec test-pg${{ matrix.pg_version }} psql -U postgres -f /tmp/tests/test-1-config.sql
- name: "🧪 Test 2: TimescaleDB"
run: docker exec test-pg${{ matrix.pg_version }} psql -U postgres -f /tmp/tests/test-2-timescale.sql
- name: "🧪 Test 3: VectorChord"
run: docker exec test-pg${{ matrix.pg_version }} psql -U postgres -f /tmp/tests/test-3-vector.sql
- name: "🧪 Test 4: Hybrid Scenarios"
run: docker exec test-pg${{ matrix.pg_version }} psql -U postgres -f /tmp/tests/test-4-hybrid.sql
- name: 🧹 Cleanup test container
if: always()
run: docker rm -f test-pg${{ matrix.pg_version }} || true
- name: 🚀 Push Docker image
uses: https://github.com/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: https://github.com/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: 🧹 Cleanup Docker images
if: always()
run: |
docker rmi postgres-ts-vectors:pg${{ matrix.pg_version }}-test || true
docker image prune -f