Skip to content

Commit 5193c58

Browse files
committed
feat: pin all versions including PostGIS
All components are now fully pinned: - PostgreSQL: 17.9, 16.13, 15.17, 14.22 - PostGIS: 3.6.2 (pinned via apt version) - pgvector: 0.8.2 (pinned via git tag) Image tags: postgres-17.9-postgis-3.6.2-pgvector-0.8.2
1 parent f845c7a commit 5193c58

3 files changed

Lines changed: 35 additions & 31 deletions

File tree

.github/workflows/publish.yml

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,19 @@ jobs:
1919
matrix:
2020
include:
2121
- pg_version: "17.9"
22+
postgis_version: "3.6.2"
2223
pgvector_version: "0.8.2"
2324
latest: true
2425
- pg_version: "16.13"
26+
postgis_version: "3.6.2"
2527
pgvector_version: "0.8.2"
2628
latest: false
2729
- pg_version: "15.17"
30+
postgis_version: "3.6.2"
2831
pgvector_version: "0.8.2"
2932
latest: false
3033
- pg_version: "14.22"
34+
postgis_version: "3.6.2"
3135
pgvector_version: "0.8.2"
3236
latest: false
3337

@@ -45,34 +49,26 @@ jobs:
4549
- name: Set up Docker Buildx
4650
uses: docker/setup-buildx-action@v4
4751

48-
- name: Build Docker image
52+
- name: Extract metadata (tags, labels) for Docker
53+
id: meta
54+
uses: docker/metadata-action@v6
55+
with:
56+
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ github.event.repository.name }}
57+
tags: |
58+
type=raw,value=postgres-${{ matrix.pg_version }}-postgis-${{ matrix.postgis_version }}-pgvector-${{ matrix.pgvector_version }}
59+
type=raw,value=latest,enable=${{ matrix.latest }}
60+
type=ref,event=tag
61+
62+
- name: Build and push Docker image
4963
uses: docker/build-push-action@v7
5064
with:
5165
context: .
52-
load: true
53-
tags: local-build:${{ matrix.pg_version }}
66+
push: true
67+
tags: ${{ steps.meta.outputs.tags }}
68+
labels: ${{ steps.meta.outputs.labels }}
5469
build-args: |
5570
PG_VERSION=${{ matrix.pg_version }}
71+
POSTGIS_VERSION=${{ matrix.postgis_version }}
5672
PGVECTOR_VERSION=${{ matrix.pgvector_version }}
57-
58-
- name: Detect PostGIS version
59-
id: postgis
60-
run: |
61-
PG_MAJOR=$(echo "${{ matrix.pg_version }}" | cut -d. -f1)
62-
POSTGIS_VERSION=$(docker run --rm local-build:${{ matrix.pg_version }} \
63-
dpkg-query -W -f='${Version}' "postgresql-${PG_MAJOR}-postgis-3" | cut -d+ -f1)
64-
echo "version=${POSTGIS_VERSION}" >> "$GITHUB_OUTPUT"
65-
echo "Detected PostGIS version: ${POSTGIS_VERSION}"
66-
67-
- name: Tag and push Docker image
68-
run: |
69-
IMAGE="${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ github.event.repository.name }}"
70-
TAG="postgres-${{ matrix.pg_version }}-postgis-${{ steps.postgis.outputs.version }}-pgvector-${{ matrix.pgvector_version }}"
71-
docker tag local-build:${{ matrix.pg_version }} "${IMAGE}:${TAG}"
72-
docker push "${IMAGE}:${TAG}"
73-
echo "Pushed ${IMAGE}:${TAG}"
74-
if [ "${{ matrix.latest }}" = "true" ]; then
75-
docker tag local-build:${{ matrix.pg_version }} "${IMAGE}:latest"
76-
docker push "${IMAGE}:latest"
77-
echo "Pushed ${IMAGE}:latest"
78-
fi
73+
cache-from: type=gha
74+
cache-to: type=gha,mode=max

.github/workflows/test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ jobs:
1414
matrix:
1515
include:
1616
- pg_version: "17.9"
17+
postgis_version: "3.6.2"
1718
pgvector_version: "0.8.2"
1819
- pg_version: "16.13"
20+
postgis_version: "3.6.2"
1921
pgvector_version: "0.8.2"
2022
- pg_version: "15.17"
23+
postgis_version: "3.6.2"
2124
pgvector_version: "0.8.2"
2225
- pg_version: "14.22"
26+
postgis_version: "3.6.2"
2327
pgvector_version: "0.8.2"
2428

2529
steps:
@@ -36,6 +40,7 @@ jobs:
3640
tags: postgres-test:pg${{ matrix.pg_version }}
3741
build-args: |
3842
PG_VERSION=${{ matrix.pg_version }}
43+
POSTGIS_VERSION=${{ matrix.postgis_version }}
3944
PGVECTOR_VERSION=${{ matrix.pgvector_version }}
4045
4146
- name: Start PostgreSQL container and test extensions

Dockerfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Default versions - can be overridden at build time using --build-arg
22
ARG PG_VERSION=17.9
3+
ARG POSTGIS_VERSION=3.6.2
34
ARG PGVECTOR_VERSION=0.8.2
45

56
FROM postgres:${PG_VERSION}
67

78
# Re-declare ARGs after FROM to make them available in this build stage
9+
ARG POSTGIS_VERSION
810
ARG PGVECTOR_VERSION
911

1012
LABEL maintainer="TypeORM"
@@ -29,14 +31,15 @@ RUN apt-get update \
2931
gcc \
3032
"postgresql-server-dev-${PG_MAJOR}"
3133

32-
# Install PostGIS
33-
RUN apt-get update \
34+
# Install pinned PostGIS version (apt packages use major version in name)
35+
RUN POSTGIS_MAJOR=$(echo "${POSTGIS_VERSION}" | cut -d. -f1) \
36+
&& apt-get update \
3437
&& apt-get install -y --no-install-recommends \
35-
postgis \
36-
"postgresql-${PG_MAJOR}-postgis-3" \
37-
"postgresql-${PG_MAJOR}-postgis-3-scripts"
38+
"postgis=${POSTGIS_VERSION}+dfsg*" \
39+
"postgresql-${PG_MAJOR}-postgis-${POSTGIS_MAJOR}=${POSTGIS_VERSION}+dfsg*" \
40+
"postgresql-${PG_MAJOR}-postgis-${POSTGIS_MAJOR}-scripts=${POSTGIS_VERSION}+dfsg*"
3841

39-
# Build and install pgvector from source to pin exact version
42+
# Build and install pinned pgvector version from source
4043
RUN apt-get update \
4144
&& apt-get install -y --no-install-recommends git make gcc "postgresql-server-dev-${PG_MAJOR}" \
4245
&& mkdir -p /usr/src/pgvector \

0 commit comments

Comments
 (0)