Skip to content

Commit ab957b2

Browse files
authored
Build images with PG 15 installed (#917)
This commit updates the build workflow to build and push an extra base Docker image with PG 15 installed. The tag is not meant to be permanent and is just meant to help us update our postgres templates to support PG 15 within the same commit. The tag will be removed once our `discourse/base:release` ships with PG 15 by default.
1 parent 136c638 commit ab957b2

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ jobs:
7373
run: |
7474
ruby auto_build.rb base_release_main_${{ matrix.arch }}
7575
76+
# Temporarily build images with PG 15 so that we can ship the changes to the postgres templates in the same PR.
77+
- name: build release images for `main` branch with PG 15
78+
working-directory: image
79+
run: |
80+
ruby auto_build.rb base_release_main_${{ matrix.arch }}_pg_15
81+
7682
- name: build release images for `stable` branch
7783
working-directory: image
7884
run: |
@@ -81,6 +87,7 @@ jobs:
8187
- name: tag release images
8288
run: |
8389
docker tag discourse/base:build_release_main_${{ matrix.arch }} discourse/base:2.0.${{ env.TIMESTAMP }}-main-${{ matrix.arch }}
90+
docker tag discourse/base:build_release_main_${{ matrix.arch }}_pg_15 discourse/base:2.0.${{ env.TIMESTAMP }}-main-${{ matrix.arch }}-pg-15
8491
docker tag discourse/base:build_release_stable_${{ matrix.arch }} discourse/base:2.0.${{ env.TIMESTAMP }}-stable-${{ matrix.arch }}
8592
8693
- name: build test_build image for `main` branch
@@ -129,6 +136,7 @@ jobs:
129136
docker login --username discoursebuild --password $DOCKERHUB_PASSWORD
130137
docker push discourse/base:2.0.${{ env.TIMESTAMP }}-slim-${{ matrix.arch }}
131138
docker push discourse/base:2.0.${{ env.TIMESTAMP }}-main-${{ matrix.arch }}
139+
docker push discourse/base:2.0.${{ env.TIMESTAMP }}-main-${{ matrix.arch }}-pg-15
132140
docker push discourse/base:2.0.${{ env.TIMESTAMP }}-stable-${{ matrix.arch }}
133141
docker push discourse/discourse_dev:${{ env.TIMESTAMP }}-${{ matrix.arch }}
134142
@@ -137,7 +145,6 @@ jobs:
137145
run: |
138146
docker tag discourse/base:2.0.${{ env.TIMESTAMP }}-main-${{ matrix.arch }} discourse/base:aarch64
139147
docker push discourse/base:aarch64
140-
141148
push_multi_arch_manifests:
142149
runs-on: ubuntu-latest
143150
needs: [base, timestamp]
@@ -164,6 +171,11 @@ jobs:
164171
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-amd64 \
165172
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-arm64
166173
174+
# Full Discourse `main` branch timestamped with PG 15
175+
docker manifest create discourse/base:2.0.${{ env.TIMESTAMP }}-15 \
176+
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-amd64-pg-15 \
177+
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-arm64-pg-15
178+
167179
# Full Discourse `stable` branch timestamped
168180
docker manifest create discourse/base:2.0.${{ env.TIMESTAMP }}-stable \
169181
-a discourse/base:2.0.${{ env.TIMESTAMP }}-stable-amd64 \

image/auto_build.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,27 @@
4343
extra_args: "--build-arg=\"DISCOURSE_BRANCH=main\" --target discourse_release",
4444
use_cache: true,
4545
},
46+
base_release_main_amd64_pg_15: {
47+
name: "base",
48+
tag: "discourse/base:build_release_main_amd64_pg_15",
49+
extra_args:
50+
"--build-arg=\"DISCOURSE_BRANCH=main\" --target discourse_release --build-arg PG_MAJOR=15",
51+
use_cache: true,
52+
},
4653
base_release_main_arm64: {
4754
name: "base",
4855
tag: "discourse/base:build_release_main_arm64",
4956
extra_args:
5057
"--platform linux/arm64 --build-arg=\"DISCOURSE_BRANCH=main\" --target discourse_release",
5158
use_cache: true,
5259
},
60+
base_release_main_arm64_pg_15: {
61+
name: "base",
62+
tag: "discourse/base:build_release_main_arm64_pg_15",
63+
extra_args:
64+
"--build-arg=\"DISCOURSE_BRANCH=main\" --target discourse_release --build-arg PG_MAJOR=15",
65+
use_cache: true,
66+
},
5367
base_release_stable_amd64: {
5468
name: "base",
5569
tag: "discourse/base:build_release_stable_amd64",

image/base/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ RUN gpg --import /tmp/nginx_public_keys.key &&\
2828
FROM discourse/ruby:3.3.6-${DEBIAN_RELEASE}-slim AS discourse_dependencies
2929

3030
ARG DEBIAN_RELEASE
31-
ENV PG_MAJOR=13 \
31+
ARG PG_MAJOR=13
32+
ENV PG_MAJOR=${PG_MAJOR} \
3233
RUBY_ALLOCATOR=/usr/lib/libjemalloc.so \
3334
LEFTHOOK=0 \
3435
DEBIAN_RELEASE=${DEBIAN_RELEASE}

0 commit comments

Comments
 (0)