This commit is contained in:
Jeff Wong 2025-06-13 14:27:08 -07:00 committed by GitHub
commit b8333b602b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 76 additions and 11 deletions

View File

@ -65,6 +65,16 @@ jobs:
run: |
ruby auto_build.rb base_slim_stable_${{ matrix.arch }}
- name: build web_only images for `main` branch
working-directory: image
run: |
ruby auto_build.rb base_web_only_main_${{ matrix.arch }}
- name: build web_only images for `stable` branch
working-directory: image
run: |
ruby auto_build.rb base_web_only_stable_${{ matrix.arch }}
- name: build release images for `main` branch
working-directory: image
run: |
@ -83,6 +93,8 @@ jobs:
- name: tag release images
run: |
docker tag discourse/base:build_web_only_main_${{ matrix.arch }} discourse/base:2.0.${{ env.TIMESTAMP }}-web-only-main-${{ matrix.arch }}
docker tag discourse/base:build_web_only_stable_${{ matrix.arch }} discourse/base:2.0.${{ env.TIMESTAMP }}-web-only-stable-${{ matrix.arch }}
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 }}
@ -132,6 +144,8 @@ jobs:
run: |
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 }}-web-only-main-${{ matrix.arch }}
docker push discourse/base:2.0.${{ env.TIMESTAMP }}-web-only-stable-${{ 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 }}
@ -163,6 +177,26 @@ jobs:
-a discourse/base:2.0.${{ env.TIMESTAMP }}-slim-amd64 \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-slim-arm64
# Web-Only `main` timestamped
docker manifest create discourse/base:2.0.${{ env.TIMESTAMP }}-web-only \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-web-only-main-amd64 \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-web-only-main-arm64
# Web-Only `main` release
docker manifest create discourse/base:web-only \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-web-only-main-amd64 \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-web-only-main-arm64
# Web-Only `stable` timestamped
docker manifest create discourse/base:2.0.${{ env.TIMESTAMP }}-web-only-stable \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-web-only-stable-amd64 \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-web-only-stable-arm64
# Web-Only `stable` release
docker manifest create discourse/base:web-only-stable \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-web-only-stable-amd64 \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-web-only-stable-arm64
# Full Discourse `main` branch timestamped
docker manifest create discourse/base:2.0.${{ env.TIMESTAMP }} \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-amd64 \
@ -200,6 +234,10 @@ jobs:
docker manifest push discourse/base:2.0.${{ env.TIMESTAMP }}-slim
docker manifest push discourse/base:slim
docker manifest push discourse/base:2.0.${{ env.TIMESTAMP }}-web-only
docker manifest push discourse/base:2.0.${{ env.TIMESTAMP }}-web-only-stable
docker manifest push discourse/base:web-only
docker manifest push discourse/base:web-only-stable
docker manifest push discourse/base:2.0.${{ env.TIMESTAMP }}
docker manifest push discourse/base:2.0.${{ env.TIMESTAMP }}-pg-15
docker manifest push discourse/base:2.0.${{ env.TIMESTAMP }}-stable

View File

@ -37,6 +37,31 @@ images = {
"--platform linux/arm64 --target discourse_slim --build-arg=\"DISCOURSE_BRANCH=stable\"",
use_cache: true,
},
base_web_only_main_amd64: {
name: "base",
tag: "discourse/base:build_web_only_main_amd64",
extra_args: "--target discourse_web_only",
use_cache: true,
},
base_web_only_stable_amd64: {
name: "base",
tag: "discourse/base:build_web_only_stable_amd64",
extra_args: "--target discourse_web_only --build-arg=\"DISCOURSE_BRANCH=stable\"",
use_cache: true,
},
base_web_only_main_arm64: {
name: "base",
tag: "discourse/base:build_web_only_main_arm64",
extra_args: "--platform linux/arm64 --target discourse_web_only",
use_cache: true,
},
base_web_only_stable_arm64: {
name: "base",
tag: "discourse/base:build_web_only_stable_arm64",
extra_args:
"--platform linux/arm64 --target discourse_web_only --build-arg=\"DISCOURSE_BRANCH=stable\"",
use_cache: true,
},
base_release_main_amd64: {
name: "base",
tag: "discourse/base:build_release_main_amd64",

View File

@ -92,7 +92,6 @@ RUN --mount=type=tmpfs,target=/var/log \
sh -c "test -f /sbin/initctl || ln -s /bin/true /sbin/initctl"; \
apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get -y install runit socat \
libpq-dev postgresql-client-${PG_MAJOR} \
postgresql-${PG_MAJOR} postgresql-contrib-${PG_MAJOR} postgresql-${PG_MAJOR}-pgvector \
nodejs yarn &&\
mkdir -p /etc/runit/1.d
@ -130,7 +129,6 @@ ADD install-jemalloc /tmp/install-jemalloc
RUN /tmp/install-jemalloc
ADD install-redis /tmp/install-redis
RUN /tmp/install-redis
ADD install-oxipng /tmp/install-oxipng
RUN /tmp/install-oxipng
@ -145,14 +143,6 @@ RUN gem install pups --force &&\
ADD thpoff.c /src/thpoff.c
RUN gcc -o /usr/local/sbin/thpoff /src/thpoff.c && rm /src/thpoff.c
# clean up for docker squash
RUN rm -fr /usr/local/share/doc &&\
rm -fr /usr/local/share/ri &&\
rm -fr /var/lib/apt/lists/* &&\
rm -fr /root/.gem &&\
rm -fr /root/.npm &&\
rm -fr /tmp/*
# this is required for aarch64 which uses buildx
# see https://github.com/docker/buildx/issues/150
RUN rm -f /etc/service
@ -168,7 +158,7 @@ RUN install -dm 0755 -o discourse -g discourse /var/www/discourse &&\
sudo -u discourse git clone --branch $DISCOURSE_BRANCH --filter=tree:0 https://github.com/discourse/discourse.git /var/www/discourse &&\
gem install bundler --conservative -v $(awk '/BUNDLED WITH/ { getline; gsub(/ /,""); print $0 }' /var/www/discourse/Gemfile.lock)
FROM discourse_slim AS discourse_release
FROM discourse_slim AS discourse_web_only
ENV RAILS_ENV=production
RUN cd /var/www/discourse &&\
@ -181,3 +171,9 @@ RUN cd /var/www/discourse &&\
RUN cd /var/www/discourse &&\
sudo -u discourse /bin/bash -c 'if [ -f yarn.lock ]; then yarn install --frozen-lockfile && yarn cache clean; else pnpm install --frozen-lockfile; fi'
FROM discourse_web_only AS discourse_release
RUN --mount=type=tmpfs,target=/var/log \
apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get -y install \
postgresql-${PG_MAJOR} postgresql-contrib-${PG_MAJOR} postgresql-${PG_MAJOR}-pgvector
RUN /tmp/install-redis

View File

@ -13,6 +13,12 @@ FROM discourse/base:$from_tag
#LABEL maintainer="Sam Saffron \"https://twitter.com/samsaffron\""
# Install Postgres and Redis
RUN --mount=type=tmpfs,target=/var/log \
apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get -y install \
postgresql-${PG_MAJOR} postgresql-contrib-${PG_MAJOR} postgresql-${PG_MAJOR}-pgvector
RUN /tmp/install-redis
# Remove the code added on base image
RUN rm -rf /var/www/*