Skip to content
Commits on Source (65)
variables:
GIT_SUBMODULE_STRATEGY: recursive
DOCKER_HUB_REPO: libresh/discourse
.compute_version: &compute_version
- if [ "$CHANNEL" == "stable" ]; then export FILTER="grep -v beta"; else export FILTER="grep beta"; fi
- export DISCOURSE_VERSION=`wget -qO- https://api.github.com/repos/discourse/discourse/tags | grep name | cut -d'"' -f4 | $FILTER | head -n1`
- export DATE=`date "+%Y-%m-%dT%H-%M-%SZ"`
.test:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
DESTINATION: "--no-push"
script:
- *compute_version
- export DISCOURSE_MAJOR=`echo $DISCOURSE_VERSION | cut -d"." -f1-3`
- echo $DISCOURSE_MAJOR
- echo $DISCOURSE_VERSION
- /kaniko/executor --single-snapshot --context . ${DESTINATION} --build-arg DISCOURSE_VERSION=$DISCOURSE_VERSION
except:
- master
test-beta:
extends: .test
variables:
CHANNEL: "beta"
test-stable:
extends: .test
variables:
CHANNEL: "stable"
.push:
extends: .test
before_script:
- *compute_version
- cp $DOCKER_SECRET_CONFIG /kaniko/.docker/config.json
- export DESTINATION="--destination ${DOCKER_HUB_REPO}:${DISCOURSE_VERSION}-${DATE} --destination ${DOCKER_HUB_REPO}:${DISCOURSE_VERSION} --destination ${DOCKER_HUB_REPO}:${DISCOURSE_MAJOR} --destination ${DOCKER_HUB_REPO}:${CHANNEL}"
except: []
only:
- master
# bug: the CHANNEL variable is not passed to the Dockerfile.
push-beta:
extends: .push
variables:
CHANNEL: "beta"
#push-stable:
# extends: .push
# variables:
# CHANNEL: "stable"
[submodule "install/discourse-akismet"]
path = install/discourse-akismet
url = https://github.com/discourse/discourse-akismet
[submodule "install/discourse-assign"]
path = install/discourse-assign
url = https://github.com/discourse/discourse-assign
[submodule "install/discourse-calendar"]
path = install/discourse-calendar
url = https://github.com/discourse/discourse-calendar
[submodule "install/discourse-docs"]
path = install/discourse-docs
url = https://github.com/discourse/discourse-docs
[submodule "install/discourse-encrypt"]
path = install/discourse-encrypt
url = https://github.com/discourse/discourse-encrypt
[submodule "install/discourse-locations"]
path = install/discourse-locations
url = https://github.com/paviliondev/discourse-locations
[submodule "install/discourse-legal-tools"]
path = install/discourse-legal-tools
url = https://github.com/paviliondev/discourse-legal-tools
[submodule "install/discourse-math"]
path = install/discourse-math
url = https://github.com/discourse/discourse-math
[submodule "install/discourse-openid-connect"]
path = install/discourse-openid-connect
url = https://github.com/discourse/discourse-openid-connect
[submodule "install/discourse-solved"]
path = install/discourse-solved
url = https://github.com/discourse/discourse-solved
[submodule "install/discourse-topic-voting"]
path = install/discourse-topic-voting
url = https://github.com/discourse/discourse-topic-voting
[submodule "install/discourse-air"]
path = install/discourse-air
url = https://github.com/discourse/discourse-air
[submodule "install/discourse-reactions"]
path = install/discourse-reactions
url = https://github.com/discourse/discourse-reactions
[submodule "install/discourse-templates"]
path = install/discourse-templates
url = https://github.com/discourse/discourse-templates
[submodule "install/discourse-docs-card-filter"]
path = install/discourse-docs-card-filter
url = https://github.com/discourse/discourse-docs-card-filter
[submodule "install/discourse-events"]
path = install/discourse-events
url = https://github.com/paviliondev/discourse-events
FROM ruby:2.4.1 FROM golang:1.22 as refresh-assets
WORKDIR /app
ENV RAILS_ENV=production \ COPY refresh-assets/go.mod refresh-assets/go.sum ./
RUBY_GC_MALLOC_LIMIT=90000000 \ RUN go mod download
RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 \ COPY refresh-assets/*.go ./
DISCOURSE_DB_HOST=postgres \ RUN CGO_ENABLED=0 GOOS=linux go build -o /refresh-assets
DISCOURSE_REDIS_HOST=redis \
DISCOURSE_SERVE_STATIC_ASSETS=true \ FROM debian:bullseye-slim
GIFSICLE_VERSION=1.88 \
PNGQUANT_VERSION=2.8.0 \ # slim https://github.com/discourse/discourse_docker/blob/main/image/base/slim.Dockerfile#L5
DISCOURSE_VERSION=1.9.0.beta11 \ ENV RUBY_ALLOCATOR=/usr/lib/libjemalloc.so.1 \
BUILD_DEPS="\ RUSTUP_HOME=/usr/local/rustup \
autoconf \ CARGO_HOME=/usr/local/cargo \
jhead \ PATH=/usr/local/cargo/bin:$PATH \
libbz2-dev \ LEFTHOOK=0
pkg-config \ # release https://github.com/discourse/discourse_docker/blob/main/image/base/release.Dockerfile#L6
libfreetype6-dev \ ENV RAILS_ENV=production
libjpeg-dev \ # web template https://github.com/discourse/discourse_docker/blob/main/templates/web.template.yml#L1
libjpeg-turbo-progs \ ENV DISCOURSE_SERVE_STATIC_ASSETS=true \
libtiff-dev" SKIP_EMBER_CLI_COMPILE=1 \
RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 \
RUBY_GC_HEAP_INIT_SLOTS=400000 \
RUN addgroup --gid 1000 discourse \ RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5
&& adduser --system --uid 1000 --ingroup discourse --shell /bin/bash discourse \
&& cd /home/discourse \ #LABEL maintainer="Sam Saffron \"https://twitter.com/samsaffron\""
&& mkdir -p ./tmp/sockets \
&& git clone --branch v${DISCOURSE_VERSION} https://github.com/discourse/discourse.git \ RUN echo 'deb http://deb.debian.org/debian bullseye-backports main' > /etc/apt/sources.list.d/bullseye-backports.list
&& cd ./discourse \ RUN echo "debconf debconf/frontend select Teletype" | debconf-set-selections
&& chown -R discourse:discourse . \ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install gnupg sudo curl
&& git remote set-branches --add origin tests-passed \
&& curl --silent --location https://deb.nodesource.com/setup_8.x | bash - \ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y locales locales-all
&& apt-get update && apt-get install -y --no-install-recommends \ ENV LC_ALL en_US.UTF-8
${BUILD_DEPS} \ ENV LANG en_US.UTF-8
jpegoptim \ ENV LANGUAGE en_US.UTF-8
libxml2 \
nodejs \ RUN curl --silent --location https://deb.nodesource.com/setup_18.x | sudo bash -
optipng \ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
ghostscript \ RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
gsfonts \ RUN apt-get -y update
imagemagick \ # install these without recommends to avoid pulling in e.g.
&& npm install svgo uglify-js@"<3" -g \ # X11 libraries, mailutils
&& cd /tmp \ RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends git jq
&& curl -O http://www.lcdf.org/gifsicle/gifsicle-$GIFSICLE_VERSION.tar.gz \ RUN DEBIAN_FRONTEND=noninteractive apt-get -y install autoconf build-essential ca-certificates \
&& tar zxf gifsicle-$GIFSICLE_VERSION.tar.gz \ libxslt-dev libcurl4-openssl-dev \
&& cd gifsicle-$GIFSICLE_VERSION \ libssl-dev libyaml-dev libtool \
&& ./configure && make install \ libpcre3 libpcre3-dev zlib1g zlib1g-dev \
&& cd /tmp \ libxml2-dev gawk \
&& rm gifsicle-$GIFSICLE_VERSION.tar.gz \ libreadline-dev libpq-dev \
&& rm -rf gifsicle-$GIFSICLE_VERSION \ psmisc whois brotli libunwind-dev \
&& git clone -b $PNGQUANT_VERSION --single-branch https://github.com/pornel/pngquant \ libtcmalloc-minimal4 cmake \
&& cd pngquant \ pngcrush pngquant ripgrep
&& make && make install \
&& rm -rf pngquant \ RUN cd / &&\
&& cd /home/discourse/discourse \ apt-get clean &&\
&& bundle config build.nokogiri --use-system-libraries \ locale-gen en_US &&\
&& bundle install --deployment --without test --without development \ DEBIAN_FRONTEND=noninteractive apt-get install -y wget nodejs yarn &&\
&& apt-get remove -y --purge ${BUILD_DEPS} \ npm install -g terser uglify-js pnpm
&& rm -rf /var/lib/apt/lists/*
ADD install-imagemagick /tmp/install-imagemagick
WORKDIR /home/discourse/discourse RUN /tmp/install-imagemagick
ADD install-jemalloc /tmp/install-jemalloc
RUN /tmp/install-jemalloc
ADD install-rust /tmp/install-rust
ADD install-ruby /tmp/install-ruby
ADD install-oxipng /tmp/install-oxipng
RUN /tmp/install-rust && /tmp/install-ruby && /tmp/install-oxipng && rustup self uninstall -y
RUN echo 'gem: --no-document' >> /usr/local/etc/gemrc &&\
gem update --system
# This tool allows us to disable huge page support for our current process
# since the flag is preserved through forks and execs it can be used on any
# process
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/share/man &&\
rm -fr /usr/share/doc &&\
rm -fr /usr/share/vim/vim74/doc &&\
rm -fr /usr/share/vim/vim74/lang &&\
rm -fr /usr/share/vim/vim74/spell/en* &&\
rm -fr /usr/share/vim/vim74/tutor &&\
rm -fr /usr/local/share/doc &&\
rm -fr /usr/local/share/ri &&\
rm -fr /usr/local/share/ruby-build &&\
rm -fr /var/lib/apt/lists/* &&\
rm -fr /root/.gem &&\
rm -fr /root/.npm &&\
rm -fr /tmp/*
# this can probably be done, but I worry that people changing PG locales will have issues
# cd /usr/share/locale && rm -fr `ls -d */ | grep -v en`
# this is required for aarch64 which uses buildx
# see https://github.com/docker/buildx/issues/150
RUN rm -f /etc/service
ARG DISCOURSE_VERSION
# Discourse specific bits
RUN useradd discourse -s /bin/bash -m -U &&\
install -dm 0755 -o discourse -g discourse /var/www/discourse &&\
sudo -u discourse curl -s -L https://github.com/discourse/discourse/archive/refs/tags/${DISCOURSE_VERSION}.tar.gz | tar xvz -C /var/www/discourse --strip-components 1 &&\
gem install bundler --conservative -v $(awk '/BUNDLED WITH/ { getline; gsub(/ /,""); print $0 }' /var/www/discourse/Gemfile.lock) &&\
chown -R discourse:discourse /var/www/discourse
USER discourse USER discourse
WORKDIR /var/www/discourse
RUN bundle config --local deployment true &&\
bundle config --local path ./vendor/bundle &&\
bundle config --local without test development &&\
bundle config --local jobs 4 && \
bundle install &&\
yarn install --frozen-lockfile &&\
yarn cache clean &&\
find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} +
COPY --chown=1000:1000 install/ /var/www/discourse/plugins/
RUN cd app/assets/javascripts/discourse && \
/var/www/discourse/app/assets/javascripts/node_modules/.bin/ember build -prod
COPY --chown=1000:1000 app.sh .
COPY --chown=1000:1000 sidekiq.sh .
COPY --chown=1000:1000 upgrade.sh .
COPY --chown=1000:1000 --from=refresh-assets /refresh-assets .
CMD bundle exec rails server -b 0.0.0.0 CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
\ No newline at end of file
VERSION=$(shell cat VERSION)
TAG?=${VERSION}
all: update build push
update:
python3 scripts/discourse-plugins.py ${VERSION}
build:
sudo podman build -t quay.io/libre.sh/discourse:${TAG} --build-arg DISCOURSE_VERSION=${VERSION} .
push:
sudo podman push quay.io/libre.sh/discourse:${TAG}
\ No newline at end of file
# docker-discourse # docker-discourse
discourse image for discourse service Discourse image for discourse service
It is based on [upstream discourse image](https://hub.docker.com/r/discourse/base/)
## Discourse plugins ## Discourse plugins
This image supports installing Discourse plugins at build time, via the `DISCOURSE_ADDITIONAL_PLUGINS` [build arg](https://docs.docker.com/engine/reference/builder/#/arg). Set it to a whitespace (space, tab, newline) separated list if valid `git` URLs of plugins to be installed at build time. This image supports installing Discourse plugins at build time, via the `install/plugin-list` file. It lists`git` URLs of plugins to be installed at build time.
\ No newline at end of file \ No newline at end of file
v3.2.2
\ No newline at end of file
#!/bin/bash
set -euxo pipefail
bundle exec rake assets:precompile:theme_transpiler
exec bundle exec config/unicorn_launcher -E production -c config/unicorn.conf.rb
\ No newline at end of file
#!/bin/bash
set -e
# version check: https://github.com/ImageMagick/ImageMagick/releases
IMAGE_MAGICK_VERSION="7.1.0-62"
IMAGE_MAGICK_HASH="d282117bc6d0e91ad1ad685d096623b96ed8e229f911c891d83277b350ef884a"
# We use debian, but GitHub CI is stuck on Ubuntu Bionic, so this must be compatible with both
LIBJPEGTURBO=$(cat /etc/issue | grep -qi Debian && echo 'libjpeg62-turbo libjpeg62-turbo-dev' || echo 'libjpeg-turbo8 libjpeg-turbo8-dev')
# Ubuntu 22.04/22.10 doesn't have libwebp6
LIBWEBP=$(cat /etc/issue | grep -qi 'Ubuntu 22' && echo 'libwebp7' || echo 'libwebp6')
PREFIX=/usr/local
WDIR=/tmp/imagemagick
# Install build deps
apt -y -q remove imagemagick
apt -y -q install git make gcc pkg-config autoconf curl g++ yasm cmake \
libde265-0 libde265-dev ${LIBJPEGTURBO} x265 libx265-dev libtool \
libpng16-16 libpng-dev ${LIBJPEGTURBO} ${LIBWEBP} libwebp-dev libgomp1 \
libwebpmux3 libwebpdemux2 ghostscript libxml2-dev libxml2-utils librsvg2-dev \
libltdl7-dev libbz2-dev gsfonts libtiff-dev libfreetype6-dev libjpeg-dev
# Ubuntu doesn't like `bullseye-backports`
if cat /etc/issue | grep -qi 'Ubuntu 22'; then
apt -y install libheif1 libaom-dev libheif-dev
else
# Use backports instead of compiling it
apt -y -q install -t bullseye-backports libheif1 libaom-dev libheif-dev
fi
mkdir -p $WDIR
cd $WDIR
# Build and install ImageMagick
wget -q -O $WDIR/ImageMagick.tar.gz "https://github.com/ImageMagick/ImageMagick/archive/$IMAGE_MAGICK_VERSION.tar.gz"
sha256sum $WDIR/ImageMagick.tar.gz
echo "$IMAGE_MAGICK_HASH $WDIR/ImageMagick.tar.gz" | sha256sum -c
IMDIR=$WDIR/$(tar tzf $WDIR/ImageMagick.tar.gz --wildcards "ImageMagick-*/configure" |cut -d/ -f1)
tar zxf $WDIR/ImageMagick.tar.gz -C $WDIR
cd $IMDIR
PKG_CONF_LIBDIR=$PREFIX/lib LDFLAGS=-L$PREFIX/lib CFLAGS=-I$PREFIX/include ./configure \
--prefix=$PREFIX \
--enable-static \
--enable-bounds-checking \
--enable-hdri \
--enable-hugepages \
--with-threads \
--with-modules \
--with-quantum-depth=16 \
--without-magick-plus-plus \
--with-bzlib \
--with-zlib \
--without-autotrace \
--with-freetype \
--with-jpeg \
--without-lcms \
--with-lzma \
--with-png \
--with-tiff \
--with-heic \
--with-rsvg \
--with-webp
make all && make install
cd $HOME
rm -rf $WDIR
ldconfig /usr/local/lib
# Validate ImageMagick install
test $(convert -version | grep -o -e png -e tiff -e jpeg -e freetype -e heic -e webp | wc -l) -eq 6
#!/bin/bash
set -e
# version check: https://github.com/jemalloc/jemalloc/releases
# jemalloc stable
mkdir /jemalloc-stable
cd /jemalloc-stable
wget -q https://github.com/jemalloc/jemalloc/releases/download/3.6.0/jemalloc-3.6.0.tar.bz2
sha256sum jemalloc-3.6.0.tar.bz2
echo "e16c2159dd3c81ca2dc3b5c9ef0d43e1f2f45b04548f42db12e7c12d7bdf84fe jemalloc-3.6.0.tar.bz2" | sha256sum -c
tar --strip-components=1 -xjf jemalloc-3.6.0.tar.bz2
./configure --prefix=/usr && make && make install
cd / && rm -rf /jemalloc-stable
# jemalloc new
mkdir /jemalloc-new
cd /jemalloc-new
wget -q https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2
sha256sum jemalloc-5.3.0.tar.bz2
echo "2db82d1e7119df3e71b7640219b6dfe84789bc0537983c3b7ac4f7189aecfeaa jemalloc-5.3.0.tar.bz2" | sha256sum -c
tar --strip-components=1 -xjf jemalloc-5.3.0.tar.bz2
./configure --prefix=/usr --with-install-suffix=5.3.0 && make build_lib && make install_lib
cd / && rm -rf /jemalloc-new
#!/bin/bash
set -e
# version check: https://github.com/shssoichiro/oxipng/releases
OXIPNG_VERSION="8.0.0"
OXIPNG_HASH="ef96d6340e70900de0a38ace8f5f20878f6c256b18b0c59cd87f2b515437b87b"
OXIPNG_ARCHIVE="v${OXIPNG_VERSION}.tar.gz"
OXIPNG_DIR="oxipng-${OXIPNG_VERSION}"
# Install other deps
apt-get -y install advancecomp jhead jpegoptim libjpeg-turbo-progs optipng
cd /tmp
wget -q https://github.com/shssoichiro/oxipng/archive/refs/tags/${OXIPNG_ARCHIVE}
sha256sum ${OXIPNG_ARCHIVE}
echo "${OXIPNG_HASH} ${OXIPNG_ARCHIVE}" | sha256sum -c
tar -zxf ${OXIPNG_ARCHIVE}
cd ${OXIPNG_DIR}
CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse /usr/local/cargo/bin/cargo build --release
cp target/release/oxipng /usr/local/bin
cd / && rm -fr /tmp/${OXIPNG_DIR}
#!/bin/bash
set -e
RUBY_VERSION="3.2.2"
export CONFIGURE_OPTS="--enable-yjit"
apt-get -y install --no-install-recommends ruby bison libffi-dev
mkdir /src
git -C /src clone https://github.com/rbenv/ruby-build.git
cd /src/ruby-build && ./install.sh
cd / && rm -fr /src
ruby-build ${RUBY_VERSION} /usr/local
apt-get -y purge ruby
#!/bin/bash
set -e
# see https://github.com/rust-lang/docker-rust/blob/master/Dockerfile-debian.template
export RUSTUP_HOME=/usr/local/rustup
export CARGO_HOME=/usr/local/cargo
export PATH=/usr/local/cargo/bin:$PATH
export RUST_VERSION=1.68.0
export RUSTUP_VERSION=1.25.2
dpkgArch="$(dpkg --print-architecture)"
case "${dpkgArch##*-}" in
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='bb31eaf643926b2ee9f4d8d6fc0e2835e03c0a60f34d324048aa194f0b29a71c' ;;
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='6626b90205d7fe7058754c8e993b7efd91dedc6833a11a225b296b7c2941194f' ;;
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='4ccaa7de6b8be1569f6b764acc28e84f5eca342f5162cd5c810891bff7ed7f74' ;;
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='34392b53a25c56435b411d3e575b63aab962034dd1409ba405e708610c829607' ;;
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;;
esac
url="https://static.rust-lang.org/rustup/archive/${RUSTUP_VERSION}/${rustArch}/rustup-init"
wget "$url"
echo "${rustupSha256} *rustup-init" | sha256sum -c -
chmod +x rustup-init
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}
rm rustup-init
chmod -R a+w $RUSTUP_HOME $CARGO_HOME
rustup --version
cargo --version
rustc --version
Subproject commit 85dc24d6b58d1b16e6d225ae710633dc20c34d08
Subproject commit 248ccf70bdb8b5f3e773688cb2954548cd0fb9d9
Subproject commit 56b0de3896361b6a87523537c8f5b450d2fe0807
Subproject commit 84ef46a38cf02748ecacad16c5d9c6fec12dc8da
Subproject commit 94c7b7da216c66d773f800a714493f087affaac9
Subproject commit a601e3c5807b4152e3fe6fc6673bc2a99e6a829d
Subproject commit 9013a8ea8c7c7df55b36f329b3bb09b754a04cfe
Subproject commit cab38405bdd58a17ae67cb2166fab045d5c65019