Newer
Older
DISCOURSE_DB_HOST=postgres \
DISCOURSE_REDIS_HOST=redis \
DISCOURSE_SERVE_STATIC_ASSETS=true \
GIFSICLE_VERSION=1.87 \
PNGQUANT_VERSION=2.4.1
RUN curl --silent --location https://deb.nodesource.com/setup_4.x | bash - \
&& apt-get update && apt-get install -y --no-install-recommends \
autoconf \
ghostscript \
gsfonts \
imagemagick \
jhead \
jpegoptim \
libbz2-dev \
libfreetype6-dev \
libjpeg-dev \
libjpeg-turbo-progs \
libtiff-dev \
libxml2 \
nodejs \
optipng \
pkg-config \
&& cd /tmp \
&& curl -O http://www.lcdf.org/gifsicle/gifsicle-$GIFSICLE_VERSION.tar.gz \
&& tar zxf gifsicle-$GIFSICLE_VERSION.tar.gz \
&& cd gifsicle-$GIFSICLE_VERSION \
&& ./configure && make install && cd ..\
&& wget https://github.com/pornel/pngquant/archive/$PNGQUANT_VERSION.tar.gz \
&& tar zxf $PNGQUANT_VERSION.tar.gz \
&& cd pngquant-$PNGQUANT_VERSION \
&& ./configure && make && make install \
&& npm install svgo uglify-js -g \
&& rm -fr /tmp/* \
RUN git clone --branch v${DISCOURSE_VERSION} https://github.com/discourse/discourse.git . \
&& git remote set-branches --add origin tests-passed \
Michał 'rysiek' Woźniak
committed
&& bundle config build.nokogiri --use-system-libraries
# install additional gems
#
# this expects a space-separated list of gem names
ARG DISCOURSE_ADDITIONAL_GEMS=
RUN if [ "$DISCOURSE_ADDITIONAL_GEMS" != "" ]; then \
echo >> Gemfile ; \
echo '### DISCOURSE_ADDITIONAL_GEMS' >> Gemfile ; \
for GEM_NAME in $DISCOURSE_ADDITIONAL_GEMS; do \
echo "gem \"$GEM_NAME\"" >> Gemfile ; \
Michał 'rysiek' Woźniak
committed
# run bundler
Michał 'rysiek' Woźniak
committed
#RUN bundle install --deployment --without test --without development
RUN bundle install --without test --without development
Michał 'rysiek' Woźniak
committed
# install discourse plugins
# assumptions: no spaces in URLs (urlencoding is a thing)
#
# this expects a git-cloneable link
ARG DISCOURSE_ADDITIONAL_PLUGINS=
RUN if [ "$DISCOURSE_ADDITIONAL_PLUGINS" != "" ]; then \
for PACKAGE_LINK in $DISCOURSE_ADDITIONAL_PLUGINS; do \
git clone "$PACKAGE_LINK"; \
done; \
fi
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]