Skip to content

Commit

Permalink
Build images with PG 15 installed
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tgxworld committed Jan 17, 2025
1 parent 136c638 commit 8f443b2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ jobs:
with:
fetch-depth: 1

- name: build deps image
working-directory: image
run: |
ruby auto_build.rb base_deps_${{ matrix.arch }}
- name: build slim image for `main` branch
working-directory: image
run: |
Expand All @@ -72,6 +67,8 @@ jobs:
working-directory: image
run: |
ruby auto_build.rb base_release_main_${{ matrix.arch }}
# Temporarily build images with PG 15 so that we can ship the changes to the postgres templates in the same PR.
ruby auto_build.rb base_release_main_${{ matrix.arch }}_pg_15
- name: build release images for `stable` branch
working-directory: image
Expand All @@ -81,6 +78,7 @@ jobs:
- name: tag release images
run: |
docker tag discourse/base:build_release_main_${{ matrix.arch }} discourse/base:2.0.${{ env.TIMESTAMP }}-main-${{ matrix.arch }}
docker tag discourse/base:build_release_main_${{ matrix.arch }}_pg_15 discourse/base:2.0.${{ env.TIMESTAMP }}-main-${{ matrix.arch }}-pg-15
docker tag discourse/base:build_release_stable_${{ matrix.arch }} discourse/base:2.0.${{ env.TIMESTAMP }}-stable-${{ matrix.arch }}
- name: build test_build image for `main` branch
Expand Down Expand Up @@ -129,6 +127,7 @@ jobs:
docker login --username discoursebuild --password $DOCKERHUB_PASSWORD
docker push discourse/base:2.0.${{ env.TIMESTAMP }}-slim-${{ matrix.arch }}
docker push discourse/base:2.0.${{ env.TIMESTAMP }}-main-${{ matrix.arch }}
docker push discourse/base:2.0.${{ env.TIMESTAMP }}-main-${{ matrix.arch }}-pg-15
docker push discourse/base:2.0.${{ env.TIMESTAMP }}-stable-${{ matrix.arch }}
docker push discourse/discourse_dev:${{ env.TIMESTAMP }}-${{ matrix.arch }}
Expand All @@ -137,7 +136,6 @@ jobs:
run: |
docker tag discourse/base:2.0.${{ env.TIMESTAMP }}-main-${{ matrix.arch }} discourse/base:aarch64
docker push discourse/base:aarch64
push_multi_arch_manifests:
runs-on: ubuntu-latest
needs: [base, timestamp]
Expand All @@ -164,6 +162,11 @@ jobs:
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-amd64 \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-arm64
# Full Discourse `main` branch timestamped with PG 15
docker manifest create discourse/base:2.0.${{ env.TIMESTAMP }}-15 \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-amd64-pg-15 \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-arm64-pg-15
# Full Discourse `stable` branch timestamped
docker manifest create discourse/base:2.0.${{ env.TIMESTAMP }}-stable \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-stable-amd64 \
Expand Down
14 changes: 14 additions & 0 deletions image/auto_build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,27 @@
extra_args: "--build-arg=\"DISCOURSE_BRANCH=main\" --target discourse_release",
use_cache: true,
},
base_release_main_amd64_pg_15: {
name: "base",
tag: "discourse/base:build_release_main_amd64_pg_15",
extra_args:
"--build-arg=\"DISCOURSE_BRANCH=main\" --target discourse_release --build-arg PG_MAJOR=15",
use_cache: true,
},
base_release_main_arm64: {
name: "base",
tag: "discourse/base:build_release_main_arm64",
extra_args:
"--platform linux/arm64 --build-arg=\"DISCOURSE_BRANCH=main\" --target discourse_release",
use_cache: true,
},
base_release_main_arm64_pg_15: {
name: "base",
tag: "discourse/base:build_release_main_arm64_pg_15",
extra_args:
"--build-arg=\"DISCOURSE_BRANCH=main\" --target discourse_release --build-arg PG_MAJOR=15",
use_cache: true,
},
base_release_stable_amd64: {
name: "base",
tag: "discourse/base:build_release_stable_amd64",
Expand Down
3 changes: 2 additions & 1 deletion image/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ RUN gpg --import /tmp/nginx_public_keys.key &&\
FROM discourse/ruby:3.3.6-${DEBIAN_RELEASE}-slim AS discourse_dependencies

ARG DEBIAN_RELEASE
ENV PG_MAJOR=13 \
ARG PG_MAJOR=13
ENV PG_MAJOR=${PG_MAJOR} \
RUBY_ALLOCATOR=/usr/lib/libjemalloc.so \
LEFTHOOK=0 \
DEBIAN_RELEASE=${DEBIAN_RELEASE}
Expand Down

0 comments on commit 8f443b2

Please sign in to comment.