Skip to content

Commit 7dbaf84

Browse files
committed
Add 14-debian13 image
1 parent 5f43f99 commit 7dbaf84

File tree

16 files changed

+851
-105
lines changed

16 files changed

+851
-105
lines changed

.github/workflows/multi-build-push-postgres.yml

Lines changed: 104 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
build_and_push:
2020
strategy:
2121
matrix:
22-
version: ["12-bullseye", "14-debian11"]
22+
version: ["14-debian13"]
2323

2424
runs-on: ubuntu-latest
2525
steps:
@@ -119,106 +119,106 @@ jobs:
119119
tags: ${{ steps.meta.outputs.tags }}
120120
labels: ${{ steps.meta.outputs.labels }}
121121

122-
build_and_push_upgrade:
123-
needs: [build_and_push]
124-
strategy:
125-
matrix:
126-
version: ["12-to-14-upgrade"]
127-
128-
runs-on: ubuntu-latest
129-
steps:
130-
- name: Checkout
131-
uses: actions/checkout@v3
132-
133-
- name: Get repo name
134-
id: image_name
135-
run: |
136-
sed -E -e 's/docker-//' -e 's/^/image_name=/' <<<"${{ github.repository }}" >> "$GITHUB_OUTPUT"
137-
138-
- name: Set up QEMU
139-
uses: docker/setup-qemu-action@v2
140-
141-
- name: Set up Docker Buildx
142-
id: buildx
143-
uses: docker/setup-buildx-action@v2
144-
145-
# The values provided to these two AWS steps are always the same for Panubo owned repos
146-
- name: Configure AWS Credentials
147-
if: github.event_name != 'pull_request'
148-
uses: aws-actions/configure-aws-credentials@v1-node16
149-
with:
150-
role-to-assume: ${{ env.GITHUB_ROLE_ARN }}
151-
aws-region: us-east-1
152-
153-
- name: Login to ECR
154-
if: github.event_name != 'pull_request'
155-
uses: docker/login-action@v2
156-
with:
157-
registry: public.ecr.aws
158-
159-
- name: Login to Quay.io
160-
if: github.event_name != 'pull_request'
161-
uses: docker/login-action@v2
162-
with:
163-
registry: quay.io
164-
username: ${{ secrets.PANUBUILD_QUAYIO_USERNAME }}
165-
password: ${{ secrets.PANUBUILD_QUAYIO_TOKEN }}
166-
167-
- name: Setup BATS
168-
uses: mig4/setup-bats@v1
169-
with:
170-
bats-version: 1.7.0
171-
172-
- name: Build and export to Docker
173-
uses: docker/build-push-action@v4
174-
with:
175-
builder: ${{ steps.buildx.outputs.name }}
176-
context: ./${{ matrix.version }}
177-
cache-from: type=gha
178-
load: true
179-
tags: ${{ steps.image_name.outputs.image_name }}:test
180-
181-
- name: Test
182-
run: |
183-
cd ${{ matrix.version }}
184-
make _ci_test
185-
186-
- name: Get image version(s)
187-
id: image_version
188-
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
189-
run: |
190-
cd ${{ matrix.version }}
191-
delimiter="$(openssl rand -hex 8)"
192-
echo "image_version<<${delimiter}" >> "${GITHUB_OUTPUT}"
193-
make _ci_version >> "${GITHUB_OUTPUT}"
194-
echo "${delimiter}" >> "${GITHUB_OUTPUT}"
195-
196-
- name: Docker meta
197-
id: meta
198-
uses: docker/metadata-action@v4
199-
with:
200-
# list of Docker images to use as base name for tags
201-
images: |
202-
quay.io/${{ steps.image_name.outputs.image_name }}
203-
public.ecr.aws/${{ steps.image_name.outputs.image_name }}
204-
# generate Docker tags based on the following events/attributes
205-
tags: |
206-
${{ steps.image_version.outputs.image_version }}
207-
# type=schedule
208-
# type=ref,event=branch
209-
# type=ref,event=pr
210-
# type=semver,pattern={{version}}
211-
# type=semver,pattern={{major}}.{{minor}}
212-
# type=sha
213-
214-
- name: Build and Push
215-
uses: docker/build-push-action@v3
216-
with:
217-
builder: ${{ steps.buildx.outputs.name }}
218-
context: ./${{ matrix.version }}
219-
push: ${{ github.event_name != 'pull_request' }}
220-
cache-from: type=gha
221-
cache-to: type=gha,mode=max
222-
platforms: linux/amd64 # ,linux/arm64 # ARM builds are not supported, pglogical do not ship arm64 packages
223-
tags: ${{ steps.meta.outputs.tags }}
224-
labels: ${{ steps.meta.outputs.labels }}
122+
# build_and_push_upgrade:
123+
# needs: [build_and_push]
124+
# strategy:
125+
# matrix:
126+
# version: ["12-to-14-upgrade"]
127+
128+
# runs-on: ubuntu-latest
129+
# steps:
130+
# - name: Checkout
131+
# uses: actions/checkout@v3
132+
133+
# - name: Get repo name
134+
# id: image_name
135+
# run: |
136+
# sed -E -e 's/docker-//' -e 's/^/image_name=/' <<<"${{ github.repository }}" >> "$GITHUB_OUTPUT"
137+
138+
# - name: Set up QEMU
139+
# uses: docker/setup-qemu-action@v2
140+
141+
# - name: Set up Docker Buildx
142+
# id: buildx
143+
# uses: docker/setup-buildx-action@v2
144+
145+
# # The values provided to these two AWS steps are always the same for Panubo owned repos
146+
# - name: Configure AWS Credentials
147+
# if: github.event_name != 'pull_request'
148+
# uses: aws-actions/configure-aws-credentials@v1-node16
149+
# with:
150+
# role-to-assume: ${{ env.GITHUB_ROLE_ARN }}
151+
# aws-region: us-east-1
152+
153+
# - name: Login to ECR
154+
# if: github.event_name != 'pull_request'
155+
# uses: docker/login-action@v2
156+
# with:
157+
# registry: public.ecr.aws
158+
159+
# - name: Login to Quay.io
160+
# if: github.event_name != 'pull_request'
161+
# uses: docker/login-action@v2
162+
# with:
163+
# registry: quay.io
164+
# username: ${{ secrets.PANUBUILD_QUAYIO_USERNAME }}
165+
# password: ${{ secrets.PANUBUILD_QUAYIO_TOKEN }}
166+
167+
# - name: Setup BATS
168+
# uses: mig4/setup-bats@v1
169+
# with:
170+
# bats-version: 1.7.0
171+
172+
# - name: Build and export to Docker
173+
# uses: docker/build-push-action@v4
174+
# with:
175+
# builder: ${{ steps.buildx.outputs.name }}
176+
# context: ./${{ matrix.version }}
177+
# cache-from: type=gha
178+
# load: true
179+
# tags: ${{ steps.image_name.outputs.image_name }}:test
180+
181+
# - name: Test
182+
# run: |
183+
# cd ${{ matrix.version }}
184+
# make _ci_test
185+
186+
# - name: Get image version(s)
187+
# id: image_version
188+
# # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
189+
# run: |
190+
# cd ${{ matrix.version }}
191+
# delimiter="$(openssl rand -hex 8)"
192+
# echo "image_version<<${delimiter}" >> "${GITHUB_OUTPUT}"
193+
# make _ci_version >> "${GITHUB_OUTPUT}"
194+
# echo "${delimiter}" >> "${GITHUB_OUTPUT}"
195+
196+
# - name: Docker meta
197+
# id: meta
198+
# uses: docker/metadata-action@v4
199+
# with:
200+
# # list of Docker images to use as base name for tags
201+
# images: |
202+
# quay.io/${{ steps.image_name.outputs.image_name }}
203+
# public.ecr.aws/${{ steps.image_name.outputs.image_name }}
204+
# # generate Docker tags based on the following events/attributes
205+
# tags: |
206+
# ${{ steps.image_version.outputs.image_version }}
207+
# # type=schedule
208+
# # type=ref,event=branch
209+
# # type=ref,event=pr
210+
# # type=semver,pattern={{version}}
211+
# # type=semver,pattern={{major}}.{{minor}}
212+
# # type=sha
213+
214+
# - name: Build and Push
215+
# uses: docker/build-push-action@v3
216+
# with:
217+
# builder: ${{ steps.buildx.outputs.name }}
218+
# context: ./${{ matrix.version }}
219+
# push: ${{ github.event_name != 'pull_request' }}
220+
# cache-from: type=gha
221+
# cache-to: type=gha,mode=max
222+
# platforms: linux/amd64 # ,linux/arm64 # ARM builds are not supported, pglogical do not ship arm64 packages
223+
# tags: ${{ steps.meta.outputs.tags }}
224+
# labels: ${{ steps.meta.outputs.labels }}

14-debian13/Dockerfile

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Getting timescaledb-tune and other tools from the official timescaledb images
2+
# The timescaledb version doesn't need to mactch the postgres version here
3+
FROM timescale/timescaledb:latest-pg14 AS tools
4+
5+
# FROM quay.io/panubo/postgres:14-debian13 AS oldversions
6+
7+
FROM docker.io/postgres:14-trixie
8+
9+
ENV POSTGIS_VERSION=3.1.8 POSTGIS_SHA256=54254fb57070ce44d1da9434f472e0a82df0ef24321c2b9a22c449f756e278e7
10+
ENV TIMESCALEDB_VERSION=2.5.2 TIMESCALEDB_SHA256=b1a20832189c22ce378f009f9a24ef1db61d7131f7f79bde74fdcde87bcf2d7c
11+
ENV WALG_VERSION=2.0.1 WALG_SHA256=2640cb9110e802bf971efdc9b7a35515af7757e06693bf5c81bd4915d8d42b9c
12+
ENV POSTGRES_INITDB_ARGS="--data-checksums"
13+
14+
# Install some system utils
15+
RUN set -x \
16+
&& apt-get update \
17+
&& apt-get -y install procps lsb-release curl apt-transport-https \
18+
&& apt-get clean \
19+
&& rm -rf /var/lib/apt/lists/* \
20+
;
21+
22+
# Install PostGIS extension
23+
RUN set -x \
24+
&& apt-get update \
25+
&& apt-get -y install build-essential libsfcgal-dev libxml2-dev libgdal-dev libproj-dev libjson-c-dev libprotobuf-c-dev libgeos-dev libsfcgal2 libgdal36 libjson-c5 libproj25 libgeos-c1v5 libprotobuf-c1 protobuf-c-compiler xsltproc docbook-xsl docbook-mathml postgresql-server-dev-${PG_MAJOR} \
26+
&& DIR=$(mktemp -d) && cd ${DIR} \
27+
&& curl -s -L https://download.osgeo.org/postgis/source/postgis-${POSTGIS_VERSION}.tar.gz -o postgis.tar.gz \
28+
&& sha256sum postgis.tar.gz \
29+
&& echo "${POSTGIS_SHA256} postgis.tar.gz" | sha256sum -c - \
30+
&& tar -xzf postgis.tar.gz --strip-components=1 \
31+
&& ./configure --with-sfcgal && make -j 4 && make install \
32+
&& apt-get -y remove build-essential libsfcgal-dev libxml2-dev libgdal-dev libproj-dev libjson-c-dev libprotobuf-c-dev libgeos-dev xsltproc docbook-xsl docbook-mathml postgresql-server-dev-${PG_MAJOR} \
33+
&& apt-get -y autoremove && apt-get clean \
34+
&& rm -rf /var/lib/apt/lists/* ${DIR} \
35+
&& sed -r -i "s/[#]*\s*(shared_preload_libraries)\s*=\s*'(.*)'/\1 = 'postgis-3,\2'/;s/,'/'/" /usr/share/postgresql/postgresql.conf.sample \
36+
;
37+
38+
# Build and install TimescaleDB extension
39+
RUN set -x \
40+
&& apt-get update \
41+
&& apt-get -y install libssl3 \
42+
&& apt-get -y install cmake clang-format libkrb5-dev libssl-dev postgresql-server-dev-${PG_MAJOR} \
43+
# && ln -s /usr/bin/clang-format-7 /usr/bin/clang-format \
44+
&& DIR=$(mktemp -d) && cd ${DIR} \
45+
&& curl -s -L https://github.com/timescale/timescaledb/archive/${TIMESCALEDB_VERSION}.tar.gz -o timescaledb.tar.gz \
46+
&& ( echo "${TIMESCALEDB_SHA256} timescaledb.tar.gz" | sha256sum -c - || ( echo "Expected $(sha256sum timescaledb.tar.gz)"; exit 1; )) \
47+
&& tar -xzf timescaledb.tar.gz --strip-components=1 \
48+
&& ./bootstrap -DREGRESS_CHECKS=OFF && cd build && make && make install \
49+
&& apt-get -y remove cmake clang-format libkrb5-dev libssl-dev postgresql-server-dev-${PG_MAJOR} \
50+
&& apt-get -y autoremove && apt-get clean \
51+
&& rm -rf /var/lib/apt/lists/* ${DIR} \
52+
&& sed -r -i "s/[#]*\s*(shared_preload_libraries)\s*=\s*'(.*)'/\1 = 'timescaledb,\2'/;s/,'/'/" /usr/share/postgresql/postgresql.conf.sample \
53+
;
54+
55+
# Install WAL-G
56+
RUN set -x \
57+
&& DIR=$(mktemp -d) && cd ${DIR} \
58+
&& curl -sSf -L https://github.com/wal-g/wal-g/releases/download/v${WALG_VERSION}/wal-g-pg-ubuntu-20.04-amd64.tar.gz -o wal-g-pg-ubuntu-20.04-amd64.tar.gz \
59+
&& echo "${WALG_SHA256} wal-g-pg-ubuntu-20.04-amd64.tar.gz" | sha256sum -c - \
60+
&& tar -xzf wal-g-pg-ubuntu-20.04-amd64.tar.gz \
61+
&& cp wal-g-pg-ubuntu-20.04-amd64 /usr/local/bin/wal-g \
62+
&& rm -rf ${DIR} \
63+
;
64+
65+
# Install pglogical
66+
RUN set -x \
67+
&& apt-get update \
68+
&& apt-get install -y postgresql-${PG_MAJOR}-pglogical \
69+
&& apt-get -y autoremove \
70+
&& apt-get clean \
71+
&& rm -rf /var/lib/apt/lists/* \
72+
&& rm -rf ${DIR} \
73+
;
74+
75+
# Install pg_cron
76+
RUN set -x \
77+
&& apt-get update \
78+
&& apt-get install -y postgresql-${PG_MAJOR}-cron \
79+
&& apt-get -y autoremove \
80+
&& apt-get clean \
81+
&& rm -rf /var/lib/apt/lists/* \
82+
&& rm -rf ${DIR} \
83+
&& sed -r -i "s/[#]*\s*(shared_preload_libraries)\s*=\s*'(.*)'/\1 = 'pg_cron,\2'/;s/,'/'/" /usr/share/postgresql/postgresql.conf.sample \
84+
;
85+
86+
COPY etc/* /etc/
87+
RUN locale-gen
88+
89+
COPY bin/* /usr/local/bin/
90+
COPY docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d/
91+
COPY entry-init.d/* /entry-init.d/
92+
93+
ENTRYPOINT ["entry.sh"]
94+
CMD ["postgres"]
95+
96+
COPY --from=tools /usr/local/bin/timescaledb-tune /usr/local/bin/timescaledb-parallel-copy /usr/local/bin/
97+
98+
# COPY --from=oldversions /usr/lib/postgresql/14/lib/timescaledb-*.so /usr/lib/postgresql/14/lib/
99+
# COPY --from=oldversions /usr/share/postgresql/14/extension/timescaledb--*.sql /usr/share/postgresql/14/extension/
100+
101+
# COPY --from=oldversions /usr/lib/postgresql/14/lib/postgis-*.so /usr/lib/postgresql/14/lib/
102+
# COPY --from=oldversions /usr/lib/postgresql/14/lib/postgis_topology-*.so /usr/lib/postgresql/14/lib/
103+
# COPY --from=oldversions /usr/share/postgresql/14/extension/postgis--*.sql /usr/share/postgresql/14/extension/
104+
# COPY --from=oldversions /usr/share/postgresql/14/extension/postgis_sfcgal--*.sql /usr/share/postgresql/14/extension/
105+
# COPY --from=oldversions /usr/share/postgresql/14/extension/postgis_tiger_geocoder--*.sql /usr/share/postgresql/14/extension/
106+
# COPY --from=oldversions /usr/share/postgresql/14/extension/postgis_topology--*.sql /usr/share/postgresql/14/extension/

14-debian13/Makefile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
SHELL := /bin/bash
2+
TAG := $(shell basename ${PWD})
3+
IMAGE := panubo/postgres
4+
REGISTRY := quay.io
5+
TAG_SUFFIX := -debian11
6+
7+
PG_VERSION = $(shell docker inspect $(REGISTRY)/$(IMAGE):$(TAG) | jq -r '.[0].Config.Env[] | select(match("PG_VERSION"))')
8+
PG_VERSION_MAJOR = $(shell sed -E 's/.*=([0-9]+)\..*/\1/' <<<"$(PG_VERSION)")
9+
PG_VERSION_MINOR = $(shell sed -E 's/.*=[0-9]+\.([0-9]+).*/\1/' <<<"$(PG_VERSION)")
10+
11+
TS_VERSION = $(shell docker inspect $(REGISTRY)/$(IMAGE):$(TAG) | jq -r '.[0].Config.Env[] | select(match("TIMESCALEDB_VERSION"))')
12+
TS_VERSION_MAJOR = $(shell sed -E 's/.*=([0-9]+)\..*/\1/' <<<"$(TS_VERSION)")
13+
TS_VERSION_MINOR = $(shell sed -E 's/.*=[0-9]+\.([0-9]+).*/\1/' <<<"$(TS_VERSION)")
14+
TS_VERSION_PATCH = $(shell sed -E 's/.*=[0-9]+\.[0-9]+\.([0-9]+).*/\1/' <<<"$(TS_VERSION)")
15+
16+
build:
17+
docker build --platform linux/amd64 --pull -t $(REGISTRY)/$(IMAGE):$(TAG) .
18+
19+
.env:
20+
touch .env
21+
22+
run: .env
23+
docker run --rm -it --name $(TAG)-run --env-file .env $(REGISTRY)/$(IMAGE):$(TAG)
24+
25+
shell:
26+
docker run --rm -it --name $(TAG)-shell $(REGISTRY)/$(IMAGE):$(TAG) bash
27+
28+
push:
29+
docker tag $(REGISTRY)/$(IMAGE):$(TAG) $(REGISTRY)/$(IMAGE):$(PG_VERSION_MAJOR)$(TAG_SUFFIX)
30+
docker tag $(REGISTRY)/$(IMAGE):$(TAG) $(REGISTRY)/$(IMAGE):$(PG_VERSION_MAJOR).$(PG_VERSION_MINOR)$(TAG_SUFFIX)
31+
docker tag $(REGISTRY)/$(IMAGE):$(TAG) $(REGISTRY)/$(IMAGE):$(PG_VERSION_MAJOR).$(PG_VERSION_MINOR)-$(TS_VERSION_MAJOR).$(TS_VERSION_MINOR).$(TS_VERSION_PATCH)$(TAG_SUFFIX)
32+
docker tag $(REGISTRY)/$(IMAGE):$(TAG) $(REGISTRY)/$(IMAGE):$(PG_VERSION_MAJOR)-$(TS_VERSION_MAJOR).$(TS_VERSION_MINOR)$(TAG_SUFFIX)
33+
docker push $(REGISTRY)/$(IMAGE):$(PG_VERSION_MAJOR)$(TAG_SUFFIX)
34+
docker push $(REGISTRY)/$(IMAGE):$(PG_VERSION_MAJOR).$(PG_VERSION_MINOR)$(TAG_SUFFIX)
35+
docker push $(REGISTRY)/$(IMAGE):$(PG_VERSION_MAJOR).$(PG_VERSION_MINOR)-$(TS_VERSION_MAJOR).$(TS_VERSION_MINOR).$(TS_VERSION_PATCH)$(TAG_SUFFIX)
36+
docker push $(REGISTRY)/$(IMAGE):$(PG_VERSION_MAJOR)-$(TS_VERSION_MAJOR).$(TS_VERSION_MINOR)$(TAG_SUFFIX)
37+
38+
tags:
39+
@echo "Tags:"
40+
@echo $(REGISTRY)/$(IMAGE):$(PG_VERSION_MAJOR)$(TAG_SUFFIX)
41+
@echo $(REGISTRY)/$(IMAGE):$(PG_VERSION_MAJOR).$(PG_VERSION_MINOR)$(TAG_SUFFIX)
42+
@echo $(REGISTRY)/$(IMAGE):$(PG_VERSION_MAJOR).$(PG_VERSION_MINOR)-$(TS_VERSION_MAJOR).$(TS_VERSION_MINOR).$(TS_VERSION_PATCH)$(TAG_SUFFIX)
43+
@echo $(REGISTRY)/$(IMAGE):$(PG_VERSION_MAJOR)-$(TS_VERSION_MAJOR).$(TS_VERSION_MINOR)$(TAG_SUFFIX)
44+
45+
clean:
46+
docker rmi $(REGISTRY)/$(IMAGE):$(TAG) || true
47+
48+
_ci_test:
49+
true
50+
51+
_ci_version:
52+
@echo $(PG_VERSION_MAJOR)$(TAG_SUFFIX)
53+
@echo $(PG_VERSION_MAJOR).$(PG_VERSION_MINOR)$(TAG_SUFFIX)
54+
@echo $(PG_VERSION_MAJOR).$(PG_VERSION_MINOR)-$(TS_VERSION_MAJOR).$(TS_VERSION_MINOR).$(TS_VERSION_PATCH)$(TAG_SUFFIX)
55+
@echo $(PG_VERSION_MAJOR)-$(TS_VERSION_MAJOR).$(TS_VERSION_MINOR)$(TAG_SUFFIX)

0 commit comments

Comments
 (0)