Skip to content

Commit 7905659

Browse files
authored
Upgrade open source Postgres image from bullseye to bookworm (#104)
* Upgrade to debian:bookworm Upgrade base Postgres image to debian:bookworm * Merge `gspreadsheet_fdw` into one-liner
1 parent 1bbedcc commit 7905659

File tree

3 files changed

+69
-75
lines changed

3 files changed

+69
-75
lines changed

Dockerfile

+15-15
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ FROM postgres_base
55
ARG PYTHON_VERSION
66

77
RUN set -eux; \
8-
apt-get update; \
9-
apt-get install -y --no-install-recommends \
10-
# http deps
11-
ca-certificates \
12-
libcurl4-gnutls-dev \
13-
# mysql deps
14-
default-libmysqlclient-dev \
15-
# multicorn deps
16-
python${PYTHON_VERSION} \
17-
python${PYTHON_VERSION}-dev \
18-
# s3 deps
19-
lsb-release \
20-
wget \
21-
; \
22-
rm -rf /var/lib/apt/lists/*
8+
apt-get update; \
9+
apt-get install -y --no-install-recommends \
10+
# http deps
11+
ca-certificates \
12+
libcurl4-gnutls-dev \
13+
# mysql deps
14+
default-libmysqlclient-dev \
15+
# multicorn deps
16+
python${PYTHON_VERSION} \
17+
python${PYTHON_VERSION}-dev \
18+
# s3 deps
19+
lsb-release \
20+
wget \
21+
; \
22+
rm -rf /var/lib/apt/lists/*
2323

2424
# mysql ext
2525
COPY --from=mysql /pg_ext /

docker-bake.hcl

+20-19
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ variable "SPILO_POSTGRES_OLD_VERSIONS" {
2323
}
2424

2525
variable "PYTHON_VERSION" {
26-
default = "3.9"
26+
default = "3.11"
2727
}
2828

2929
group "default" {
@@ -41,7 +41,7 @@ target "postgres" {
4141
inherits = ["shared"]
4242

4343
contexts = {
44-
postgres_base = "docker-image://postgres:${POSTGRES_BASE_VERSION}-bullseye"
44+
postgres_base = "docker-image://postgres:${POSTGRES_BASE_VERSION}-bookworm"
4545

4646
columnar = "target:columnar_${POSTGRES_BASE_VERSION}"
4747
http = "target:http_${POSTGRES_BASE_VERSION}"
@@ -52,6 +52,7 @@ target "postgres" {
5252
}
5353

5454
args = {
55+
POSTGRES_BASE_VERSION = "${POSTGRES_BASE_VERSION}"
5556
PYTHON_VERSION = "${PYTHON_VERSION}"
5657
}
5758

@@ -170,7 +171,7 @@ target "s3" {
170171

171172
args = {
172173
ARROW_TAG = "apache-arrow-10.0.0"
173-
AWS_SDK_TAG = "1.10.4"
174+
AWS_SDK_TAG = "1.10.57"
174175
PARQUET_S3_FDW_COMMIT = "3798786831635e5b9cce5dbf33826541c3852809"
175176
}
176177
}
@@ -179,7 +180,7 @@ target "s3_13" {
179180
inherits = ["s3"]
180181

181182
contexts = {
182-
postgres_base = "docker-image://postgres:13-bullseye"
183+
postgres_base = "docker-image://postgres:13-bookworm"
183184
}
184185

185186
args = {
@@ -194,7 +195,7 @@ target "s3_15" {
194195
inherits = ["s3"]
195196

196197
contexts = {
197-
postgres_base = "docker-image://postgres:15-bullseye"
198+
postgres_base = "docker-image://postgres:15-bookworm"
198199
}
199200

200201
args = {
@@ -209,7 +210,7 @@ target "s3_14" {
209210
inherits = ["s3"]
210211

211212
contexts = {
212-
postgres_base = "docker-image://postgres:14-bullseye"
213+
postgres_base = "docker-image://postgres:14-bookworm"
213214
}
214215

215216
args = {
@@ -279,7 +280,7 @@ target "mysql_13" {
279280
inherits = ["mysql"]
280281

281282
contexts = {
282-
postgres_base = "docker-image://postgres:13-bullseye"
283+
postgres_base = "docker-image://postgres:13-bookworm"
283284
}
284285

285286
args = {
@@ -294,7 +295,7 @@ target "mysql_14" {
294295
inherits = ["mysql"]
295296

296297
contexts = {
297-
postgres_base = "docker-image://postgres:14-bullseye"
298+
postgres_base = "docker-image://postgres:14-bookworm"
298299
}
299300

300301
args = {
@@ -309,7 +310,7 @@ target "mysql_15" {
309310
inherits = ["mysql"]
310311

311312
contexts = {
312-
postgres_base = "docker-image://postgres:15-bullseye"
313+
postgres_base = "docker-image://postgres:15-bookworm"
313314
}
314315

315316
args = {
@@ -327,7 +328,7 @@ target "multicorn" {
327328

328329
args = {
329330
PYTHON_VERSION = "${PYTHON_VERSION}"
330-
MULTICORN_TAG = "v2.4"
331+
MULTICORN_TAG = "b68b75c253be72bdfd5b24bf76705c47c238d370"
331332
S3CSV_FDW_COMMIT = "f64e24f9fe3f7dbd1be76f9b8b3b5208f869e5e3"
332333
GSPREADSHEET_FDW_COMMIT = "d5bc5ae0b2d189abd6d2ee4610bd96ec39602594"
333334
}
@@ -337,7 +338,7 @@ target "multicorn_13" {
337338
inherits = ["multicorn"]
338339

339340
contexts = {
340-
postgres_base = "docker-image://postgres:13-bullseye"
341+
postgres_base = "docker-image://postgres:13-bookworm"
341342
}
342343

343344
args = {
@@ -352,7 +353,7 @@ target "multicorn_14" {
352353
inherits = ["multicorn"]
353354

354355
contexts = {
355-
postgres_base = "docker-image://postgres:14-bullseye"
356+
postgres_base = "docker-image://postgres:14-bookworm"
356357
}
357358

358359
args = {
@@ -367,7 +368,7 @@ target "multicorn_15" {
367368
inherits = ["multicorn"]
368369

369370
contexts = {
370-
postgres_base = "docker-image://postgres:15-bullseye"
371+
postgres_base = "docker-image://postgres:15-bookworm"
371372
}
372373

373374
args = {
@@ -431,7 +432,7 @@ target "ivm_13" {
431432
inherits = ["ivm"]
432433

433434
contexts = {
434-
postgres_base = "docker-image://postgres:13-bullseye"
435+
postgres_base = "docker-image://postgres:13-bookworm"
435436
}
436437

437438
args = {
@@ -446,7 +447,7 @@ target "ivm_14" {
446447
inherits = ["ivm"]
447448

448449
contexts = {
449-
postgres_base = "docker-image://postgres:14-bullseye"
450+
postgres_base = "docker-image://postgres:14-bookworm"
450451
}
451452

452453
args = {
@@ -461,7 +462,7 @@ target "ivm_15" {
461462
inherits = ["ivm"]
462463

463464
contexts = {
464-
postgres_base = "docker-image://postgres:15-bullseye"
465+
postgres_base = "docker-image://postgres:15-bookworm"
465466
}
466467

467468
args = {
@@ -486,7 +487,7 @@ target "ivm_13" {
486487
inherits = ["ivm"]
487488

488489
contexts = {
489-
postgres_base = "docker-image://postgres:13-bullseye"
490+
postgres_base = "docker-image://postgres:13-bookworm"
490491
}
491492

492493
args = {
@@ -501,7 +502,7 @@ target "ivm_14" {
501502
inherits = ["ivm"]
502503

503504
contexts = {
504-
postgres_base = "docker-image://postgres:14-bullseye"
505+
postgres_base = "docker-image://postgres:14-bookworm"
505506
}
506507

507508
args = {
@@ -516,7 +517,7 @@ target "ivm_15" {
516517
inherits = ["ivm"]
517518

518519
contexts = {
519-
postgres_base = "docker-image://postgres:15-bullseye"
520+
postgres_base = "docker-image://postgres:15-bookworm"
520521
}
521522

522523
args = {

third-party/multicorn/Dockerfile

+34-41
Original file line numberDiff line numberDiff line change
@@ -9,57 +9,50 @@ ARG S3CSV_FDW_COMMIT
99
ARG GSPREADSHEET_FDW_COMMIT
1010
ARG POSTGRES_BASE_VERSION=14
1111

12-
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install gnupg postgresql-common git -y
12+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install gnupg2 postgresql-common git -y
1313
RUN sh /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
1414
RUN set -eux; \
15-
export DEBIAN_FRONTEND=noninteractive && \
16-
apt-get update; \
17-
apt-get upgrade -y; \
18-
apt-get install -y \
19-
postgresql-${POSTGRES_BASE_VERSION} \
20-
postgresql-server-dev-${POSTGRES_BASE_VERSION} \
21-
git \
22-
build-essential \
23-
libreadline-dev \
24-
zlib1g-dev \
25-
wget \
26-
flex \
27-
bison \
28-
libxml2-dev \
29-
libxslt-dev \
30-
libssl-dev \
31-
libxml2-utils \
32-
xsltproc \
33-
python${PYTHON_VERSION} \
34-
python${PYTHON_VERSION}-dev \
35-
python3-pip
36-
37-
# Update pip to the latest
38-
RUN wget https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py && rm get-pip.py
15+
export DEBIAN_FRONTEND=noninteractive && \
16+
apt-get update; \
17+
apt-get upgrade -y; \
18+
apt-get install -y \
19+
postgresql-${POSTGRES_BASE_VERSION} \
20+
postgresql-server-dev-${POSTGRES_BASE_VERSION} \
21+
git \
22+
build-essential \
23+
libreadline-dev \
24+
zlib1g-dev \
25+
wget \
26+
flex \
27+
bison \
28+
libxml2-dev \
29+
libxslt-dev \
30+
libssl-dev \
31+
libxml2-utils \
32+
xsltproc \
33+
python${PYTHON_VERSION} \
34+
python${PYTHON_VERSION}-dev \
35+
python${PYTHON_VERSION}-venv
3936

4037
FROM setup as builder
4138

42-
RUN git clone https://github.com/pgsql-io/multicorn2 --branch ${MULTICORN_TAG} --single-branch && \
39+
RUN git clone https://github.com/pgsql-io/multicorn2 --single-branch && \
4340
cd multicorn2 && \
41+
git checkout ${MULTICORN_TAG} && \
42+
python${PYTHON_VERSION} -m venv .venv && \
43+
. .venv/bin/activate && \
4444
DESTDIR=/pg_ext USE_PGXS=1 make && \
45-
DESTDIR=/pg_ext USE_PGXS=1 make install
46-
47-
# install runtime python deps
48-
RUN python3 -m pip install \
49-
git+https://github.com/hydradatabase/s3csv_fdw@${S3CSV_FDW_COMMIT} \
50-
# gspreadsheet_fdw deps
51-
gspread \
52-
oauth2client
53-
54-
# Use a fork
55-
RUN git clone https://github.com/hydradatabase/gspreadsheet_fdw --single-branch && \
56-
cd gspreadsheet_fdw && \
57-
git checkout ${GSPREADSHEET_FDW_COMMIT} && \
58-
python3 setup.py install
45+
DESTDIR=/pg_ext USE_PGXS=1 make install && \
46+
# install s3csv_fdw
47+
python3 -m pip install \
48+
git+https://github.com/hydradatabase/s3csv_fdw@${S3CSV_FDW_COMMIT} \
49+
# install gspreadsheet_fdw
50+
gspread oauth2client \
51+
git+https://github.com/hydradatabase/gspreadsheet_fdw@${GSPREADSHEET_FDW_COMMIT}
5952

6053
FROM scratch as output
6154

6255
ARG PYTHON_VERSION
6356

6457
COPY --from=builder /pg_ext /pg_ext
65-
COPY --from=builder /usr/local/lib/python${PYTHON_VERSION}/dist-packages /python-dist-packages
58+
COPY --from=builder /multicorn2/.venv/lib/python${PYTHON_VERSION}/site-packages /python-dist-packages

0 commit comments

Comments
 (0)