Release `discourse/base` images for `discourse/discourse` stable branch (#864)
This commit updates our `build` workflow to push the following manifests which can be used to run Discourse against the stable branch. 1. discourse/base:2.0.$TIMESTAMP-stable 2. discourse/base:release-stable Co-authored-by: David Taylor <david@taylorhq.com>
This commit is contained in:
parent
3384f2c71c
commit
b47bd562cc
|
@ -44,53 +44,82 @@ jobs:
|
|||
timeout-minutes: ${{ (github.event_name == 'schedule' && 90) || ((matrix.arch == 'arm64' && 45) || 30) }}
|
||||
needs: timestamp
|
||||
env:
|
||||
ARCH: ${{matrix.arch}}
|
||||
TIMESTAMP: ${{ needs.timestamp.outputs.timestamp }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: build slim image
|
||||
|
||||
- name: build deps image
|
||||
working-directory: image
|
||||
run: |
|
||||
cd image && ruby auto_build.rb base_slim_$ARCH
|
||||
- name: tag slim images
|
||||
ruby auto_build.rb base_deps_${{ matrix.arch }}
|
||||
|
||||
- name: build slim image for `main` branch
|
||||
working-directory: image
|
||||
run: |
|
||||
docker tag discourse/base:build_slim_$ARCH discourse/base:2.0.$TIMESTAMP-slim-$ARCH
|
||||
docker tag discourse/base:build_slim_$ARCH discourse/base:slim-$ARCH
|
||||
- name: build release image
|
||||
ruby auto_build.rb base_slim_main_${{ matrix.arch }}
|
||||
|
||||
- name: tag slim image for `main` branch
|
||||
run: |
|
||||
cd image && ruby auto_build.rb base_$ARCH
|
||||
docker tag discourse/base:build_slim_main_${{ matrix.arch }} discourse/base:2.0.${{ env.TIMESTAMP }}-slim-${{ matrix.arch }}
|
||||
|
||||
- name: build slim image for `stable` branch
|
||||
working-directory: image
|
||||
run: |
|
||||
ruby auto_build.rb base_slim_stable_${{ matrix.arch }}
|
||||
|
||||
- name: build release images for `main` branch
|
||||
working-directory: image
|
||||
run: |
|
||||
ruby auto_build.rb base_release_main_${{ matrix.arch }}
|
||||
|
||||
- name: build release images for `stable` branch
|
||||
working-directory: image
|
||||
run: |
|
||||
ruby auto_build.rb base_release_stable_${{ matrix.arch }}
|
||||
|
||||
- name: tag release images
|
||||
run: |
|
||||
docker tag discourse/base:build_$ARCH discourse/base:2.0.$TIMESTAMP-$ARCH
|
||||
docker tag discourse/base:build_$ARCH discourse/base:release-$ARCH
|
||||
- name: build test_build image
|
||||
docker tag discourse/base:build_release_main_${{ matrix.arch }} discourse/base:2.0.${{ env.TIMESTAMP }}-main-${{ matrix.arch }}
|
||||
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
|
||||
working-directory: image
|
||||
run: |
|
||||
cd image && ruby auto_build.rb discourse_test_build_$ARCH
|
||||
- name: run specs
|
||||
ruby auto_build.rb discourse_test_build_${{ matrix.arch }}
|
||||
|
||||
- name: run specs for `main` branch
|
||||
run: |
|
||||
docker run --rm -e RUBY_ONLY=1 -e USE_TURBO=1 -e SKIP_PLUGINS=1 -e SKIP_LINT=1 discourse/discourse_test:build_$ARCH
|
||||
- name: build & tag dev image
|
||||
docker run --rm -e RUBY_ONLY=1 -e USE_TURBO=1 -e SKIP_PLUGINS=1 -e SKIP_LINT=1 discourse/discourse_test:build_${{ matrix.arch }}
|
||||
|
||||
- name: build & tag dev image for `main` branch
|
||||
working-directory: image
|
||||
run: |
|
||||
cd image && ruby auto_build.rb discourse_dev_$ARCH
|
||||
docker tag discourse/discourse_dev:build_$ARCH discourse/discourse_dev:$TIMESTAMP-$ARCH
|
||||
ruby auto_build.rb discourse_dev_${{ matrix.arch }}
|
||||
docker tag discourse/discourse_dev:build_${{ matrix.arch }} discourse/discourse_dev:${{ env.TIMESTAMP }}-${{ matrix.arch }}
|
||||
|
||||
- name: Print summary
|
||||
run: |
|
||||
docker images discourse/base
|
||||
|
||||
- name: push to dockerhub
|
||||
if: github.ref == 'refs/heads/main'
|
||||
env:
|
||||
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
run: |
|
||||
docker login --username discoursebuild --password $DOCKERHUB_PASSWORD
|
||||
docker push discourse/base:2.0.$TIMESTAMP-slim-$ARCH
|
||||
docker push discourse/base:2.0.$TIMESTAMP-$ARCH
|
||||
docker push discourse/discourse_dev:$TIMESTAMP-$ARCH
|
||||
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 }}-stable-${{ matrix.arch }}
|
||||
docker push discourse/discourse_dev:${{ env.TIMESTAMP }}-${{ matrix.arch }}
|
||||
|
||||
- name: Push discourse/base:aarch64 image for backwards compatibility
|
||||
if: (github.ref == 'refs/heads/main') && (matrix.arch == 'arm64')
|
||||
run: |
|
||||
docker tag discourse/base:2.0.$TIMESTAMP-$ARCH discourse/base:aarch64
|
||||
docker tag discourse/base:2.0.${{ env.TIMESTAMP }}-${{ matrix.arch }} discourse/base:aarch64
|
||||
docker push discourse/base:aarch64
|
||||
|
||||
push_multiarch_manifests:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [base, timestamp]
|
||||
|
@ -103,40 +132,52 @@ jobs:
|
|||
docker login --username discoursebuild --password ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
# Slim timestamped
|
||||
docker manifest create discourse/base:2.0.$TIMESTAMP-slim \
|
||||
-a discourse/base:2.0.$TIMESTAMP-slim-amd64 \
|
||||
-a discourse/base:2.0.$TIMESTAMP-slim-arm64
|
||||
docker manifest create discourse/base:2.0.${{ env.TIMESTAMP }}-slim \
|
||||
-a discourse/base:2.0.${{ env.TIMESTAMP }}-slim-amd64 \
|
||||
-a discourse/base:2.0.${{ env.TIMESTAMP }}-slim-arm64
|
||||
|
||||
# Slim release
|
||||
docker manifest create discourse/base:release-slim \
|
||||
-a discourse/base:2.0.$TIMESTAMP-slim-amd64 \
|
||||
-a discourse/base:2.0.$TIMESTAMP-slim-arm64
|
||||
docker manifest create discourse/base:slim \
|
||||
-a discourse/base:2.0.${{ env.TIMESTAMP }}-slim-amd64 \
|
||||
-a discourse/base:2.0.${{ env.TIMESTAMP }}-slim-arm64
|
||||
|
||||
# Full timestamped
|
||||
docker manifest create discourse/base:2.0.$TIMESTAMP \
|
||||
-a discourse/base:2.0.$TIMESTAMP-amd64 \
|
||||
-a discourse/base:2.0.$TIMESTAMP-arm64
|
||||
# Full Discourse `main` branch timestamped
|
||||
docker manifest create discourse/base:2.0.${{ env.TIMESTAMP }} \
|
||||
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-amd64 \
|
||||
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-arm64
|
||||
|
||||
# Full release
|
||||
# Full Discourse `stable` branch timestamped
|
||||
docker manifest create discourse/base:2.0.${{ env.TIMESTAMP }}-stable \
|
||||
-a discourse/base:2.0.${{ env.TIMESTAMP }}-stable-amd64 \
|
||||
-a discourse/base:2.0.${{ env.TIMESTAMP }}-stable-arm64
|
||||
|
||||
# Full Discourse `main` branch release
|
||||
docker manifest create discourse/base:release \
|
||||
-a discourse/base:2.0.$TIMESTAMP-amd64 \
|
||||
-a discourse/base:2.0.$TIMESTAMP-arm64
|
||||
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-amd64 \
|
||||
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-arm64
|
||||
|
||||
# Full Discourse `stable` branch release
|
||||
docker manifest create discourse/base:release-stable \
|
||||
-a discourse/base:2.0.${{ env.TIMESTAMP }}-stable-amd64 \
|
||||
-a discourse/base:2.0.${{ env.TIMESTAMP }}-stable-arm64
|
||||
|
||||
# Dev timestamped
|
||||
docker manifest create discourse/discourse_dev:$TIMESTAMP \
|
||||
-a discourse/discourse_dev:$TIMESTAMP-amd64 \
|
||||
-a discourse/discourse_dev:$TIMESTAMP-arm64
|
||||
docker manifest create discourse/discourse_dev:${{ env.TIMESTAMP }} \
|
||||
-a discourse/discourse_dev:${{ env.TIMESTAMP }}-amd64 \
|
||||
-a discourse/discourse_dev:${{ env.TIMESTAMP }}-arm64
|
||||
|
||||
# Dev release
|
||||
docker manifest create discourse/discourse_dev:release \
|
||||
-a discourse/discourse_dev:$TIMESTAMP-amd64 \
|
||||
-a discourse/discourse_dev:$TIMESTAMP-arm64
|
||||
-a discourse/discourse_dev:${{ env.TIMESTAMP }}-amd64 \
|
||||
-a discourse/discourse_dev:${{ env.TIMESTAMP }}-arm64
|
||||
|
||||
docker manifest push discourse/base:2.0.$TIMESTAMP-slim
|
||||
docker manifest push discourse/base:release-slim
|
||||
docker manifest push discourse/base:2.0.$TIMESTAMP
|
||||
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 }}
|
||||
docker manifest push discourse/base:2.0.${{ env.TIMESTAMP }}-stable
|
||||
docker manifest push discourse/base:release
|
||||
docker manifest push discourse/discourse_dev:$TIMESTAMP
|
||||
docker manifest push discourse/base:release-stable
|
||||
docker manifest push discourse/discourse_dev:${{ env.TIMESTAMP }}
|
||||
docker manifest push discourse/discourse_dev:release
|
||||
test:
|
||||
runs-on: ubuntu-22.04${{ ((github.event_name != 'schedule') && '-8core') || '' }}
|
||||
|
|
|
@ -4,45 +4,86 @@ require "pty"
|
|||
require "optparse"
|
||||
|
||||
images = {
|
||||
base_slim_amd64: {
|
||||
base_deps_amd64: {
|
||||
name: "base",
|
||||
tag: "discourse/base:build_slim_amd64",
|
||||
extra_args: "-f slim.Dockerfile",
|
||||
tag: "discourse/base:build_deps_amd64",
|
||||
extra_args: "--target discourse_dependencies",
|
||||
},
|
||||
base_slim_arm64: {
|
||||
base_deps_arm64: {
|
||||
name: "base",
|
||||
tag: "discourse/base:build_slim_arm64",
|
||||
extra_args: "-f slim.Dockerfile --platform linux/arm64",
|
||||
tag: "discourse/base:build_deps_arm64",
|
||||
extra_args: "--platform linux/arm64 --target discourse_dependencies",
|
||||
},
|
||||
base_amd64: {
|
||||
base_slim_main_amd64: {
|
||||
name: "base",
|
||||
tag: "discourse/base:build_amd64",
|
||||
extra_args: "-f release.Dockerfile --build-arg=\"tag=build_slim_amd64\"",
|
||||
tag: "discourse/base:build_slim_main_amd64",
|
||||
extra_args: "--target discourse_slim",
|
||||
use_cache: true,
|
||||
},
|
||||
base_arm64: {
|
||||
base_slim_stable_amd64: {
|
||||
name: "base",
|
||||
tag: "discourse/base:build_arm64",
|
||||
extra_args: "-f release.Dockerfile --platform linux/arm64 --build-arg=\"tag=build_slim_arm64\"",
|
||||
tag: "discourse/base:build_slim_main_amd64",
|
||||
extra_args: "--target discourse_slim --build-arg=\"DISCOURSE_BRANCH=stable\"",
|
||||
use_cache: true,
|
||||
},
|
||||
base_slim_main_arm64: {
|
||||
name: "base",
|
||||
tag: "discourse/base:build_slim_main_arm64",
|
||||
extra_args: "--platform linux/arm64 --target discourse_slim",
|
||||
use_cache: true,
|
||||
},
|
||||
base_slim_stable_arm64: {
|
||||
name: "base",
|
||||
tag: "discourse/base:build_slim_stable_arm64",
|
||||
extra_args:
|
||||
"--platform linux/arm64 --target discourse_slim --build-arg=\"DISCOURSE_BRANCH=stable\"",
|
||||
use_cache: true,
|
||||
},
|
||||
base_release_main_amd64: {
|
||||
name: "base",
|
||||
tag: "discourse/base:build_release_main_amd64",
|
||||
extra_args: "--build-arg=\"DISCOURSE_BRANCH=main\" --target discourse_release",
|
||||
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_stable_amd64: {
|
||||
name: "base",
|
||||
tag: "discourse/base:build_release_stable_amd64",
|
||||
extra_args: "--build-arg=\"DISCOURSE_BRANCH=stable\" --target discourse_release",
|
||||
use_cache: true,
|
||||
},
|
||||
base_release_stable_arm64: {
|
||||
name: "base",
|
||||
tag: "discourse/base:build_release_stable_arm64",
|
||||
extra_args:
|
||||
"--platform linux/arm64 --build-arg=\"DISCOURSE_BRANCH=stable\" --target discourse_release",
|
||||
use_cache: true,
|
||||
},
|
||||
discourse_test_build_amd64: {
|
||||
name: "discourse_test",
|
||||
tag: "discourse/discourse_test:build_amd64",
|
||||
extra_args: "--build-arg=\"from_tag=build_amd64\"",
|
||||
extra_args: "--build-arg=\"from_tag=build_release_main_amd64\"",
|
||||
},
|
||||
discourse_test_build_arm64: {
|
||||
name: "discourse_test",
|
||||
tag: "discourse/discourse_test:build_arm64",
|
||||
extra_args: "--platform linux/arm64 --build-arg=\"from_tag=build_arm64\"",
|
||||
extra_args: "--platform linux/arm64 --build-arg=\"from_tag=build_release_main_arm64\"",
|
||||
},
|
||||
discourse_dev_amd64: {
|
||||
name: "discourse_dev",
|
||||
tag: "discourse/discourse_dev:build_amd64",
|
||||
extra_args: "--build-arg=\"from_tag=build_slim_amd64\"",
|
||||
extra_args: "--build-arg=\"from_tag=build_slim_main_amd64\"",
|
||||
},
|
||||
discourse_dev_arm64: {
|
||||
name: "discourse_dev",
|
||||
tag: "discourse/discourse_dev:build_arm64",
|
||||
extra_args: "--platform linux/arm64 --build-arg=\"from_tag=build_slim_arm64\"",
|
||||
extra_args: "--platform linux/arm64 --build-arg=\"from_tag=build_slim_main_arm64\"",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -68,8 +109,9 @@ end
|
|||
def build(image, cli_args)
|
||||
lines =
|
||||
run(
|
||||
"cd #{image[:name]} && docker buildx build . --load --no-cache --tag #{image[:tag]} #{image[:extra_args] ? image[:extra_args] : ""} #{cli_args}",
|
||||
"cd #{image[:name]} && docker buildx build . --load #{image[:use_cache] == true ? "" : "--no-cache"} --tag #{image[:tag]} #{image[:extra_args] ? image[:extra_args] : ""} #{cli_args}",
|
||||
)
|
||||
|
||||
if lines[-1] =~ /successfully built/
|
||||
raise "Error building the image for #{image[:name]}: #{lines[-1]}"
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# VERSION: release
|
||||
|
||||
ARG DEBIAN_RELEASE=bookworm
|
||||
FROM discourse/ruby:3.3.4-${DEBIAN_RELEASE}-slim
|
||||
FROM discourse/ruby:3.3.4-${DEBIAN_RELEASE}-slim AS discourse_dependencies
|
||||
|
||||
ARG DEBIAN_RELEASE
|
||||
ENV PG_MAJOR=13 \
|
||||
|
@ -127,7 +127,24 @@ RUN rm -f /etc/service
|
|||
COPY etc/ /etc
|
||||
COPY sbin/ /sbin
|
||||
|
||||
FROM discourse_dependencies AS discourse_slim
|
||||
ARG DISCOURSE_BRANCH=main
|
||||
|
||||
# Discourse specific bits
|
||||
RUN install -dm 0755 -o discourse -g discourse /var/www/discourse &&\
|
||||
sudo -u discourse git clone --filter=tree:0 https://github.com/discourse/discourse.git /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
|
||||
ENV RAILS_ENV=production
|
||||
|
||||
RUN cd /var/www/discourse &&\
|
||||
sudo -u discourse bundle config --local deployment true &&\
|
||||
sudo -u discourse bundle config --local path ./vendor/bundle &&\
|
||||
sudo -u discourse bundle config --local without test development &&\
|
||||
sudo -u discourse bundle install --jobs $(($(nproc) - 1)) &&\
|
||||
find /var/www/discourse/vendor/bundle -name cache -not -path '*/gems/*' -type d -exec rm -rf {} + &&\
|
||||
find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} +
|
||||
|
||||
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'
|
|
@ -1,15 +0,0 @@
|
|||
ARG from=discourse/base
|
||||
ARG tag=build_slim
|
||||
|
||||
FROM $from:$tag
|
||||
|
||||
ENV RAILS_ENV=production
|
||||
|
||||
RUN cd /var/www/discourse &&\
|
||||
sudo -u discourse bundle config --local deployment true &&\
|
||||
sudo -u discourse bundle config --local path ./vendor/bundle &&\
|
||||
sudo -u discourse bundle config --local without test development &&\
|
||||
sudo -u discourse bundle install --jobs $(($(nproc) - 1)) &&\
|
||||
sudo -u discourse /bin/bash -c 'if [ -f yarn.lock ]; then yarn install --frozen-lockfile && yarn cache clean; else CI=1 pnpm install --frozen-lockfile; fi' &&\
|
||||
find /var/www/discourse/vendor/bundle -name cache -not -path '*/gems/*' -type d -exec rm -rf {} + &&\
|
||||
find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} +
|
|
@ -12,10 +12,8 @@ env:
|
|||
DISCOURSE_DB_HOST:
|
||||
DISCOURSE_DB_PORT:
|
||||
|
||||
|
||||
params:
|
||||
version: tests-passed
|
||||
|
||||
home: /var/www/discourse
|
||||
upload_size: 10m
|
||||
nginx_worker_connections: 4000
|
||||
|
|
Loading…
Reference in New Issue