Skip to content
Dockerfile 2.33 KiB
Newer Older
Pierre Ozoux's avatar
Pierre Ozoux committed
FROM ruby:2.4.1
Pierre Ozoux's avatar
Pierre Ozoux committed

Pierre Ozoux's avatar
Pierre Ozoux committed
    RUBY_GC_MALLOC_LIMIT=90000000 \
Pierre Ozoux's avatar
Pierre Ozoux committed
    RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 \
Pierre Ozoux's avatar
Pierre Ozoux committed
    DISCOURSE_DB_HOST=postgres \
    DISCOURSE_REDIS_HOST=redis \
Pierre Ozoux's avatar
Pierre Ozoux committed
    DISCOURSE_SERVE_STATIC_ASSETS=true \
Pierre Ozoux's avatar
Pierre Ozoux committed
    GIFSICLE_VERSION=1.88 \
    PNGQUANT_VERSION=2.8.0 \
unteem's avatar
unteem committed
    DISCOURSE_VERSION=2.2.0.beta2 \
Pierre Ozoux's avatar
Pierre Ozoux committed
    BUILD_DEPS="\
Pierre Ozoux's avatar
Pierre Ozoux committed
      autoconf \
      jhead \
      libbz2-dev \
      libfreetype6-dev \
      libjpeg-dev \
      libjpeg-turbo-progs \
Pierre Ozoux's avatar
Pierre Ozoux committed
      libtiff-dev \
      pkg-config"
Pierre Ozoux's avatar
Pierre Ozoux committed


RUN addgroup --gid 1000 discourse \
 && adduser --system --uid 1000 --ingroup discourse --shell /bin/bash discourse \
 && cd /home/discourse \
Pierre Ozoux's avatar
Pierre Ozoux committed
 && mkdir -p ./tmp/sockets \
Pierre Ozoux's avatar
Pierre Ozoux committed
 && git clone --branch v${DISCOURSE_VERSION} https://github.com/discourse/discourse.git \
Pierre Ozoux's avatar
Pierre Ozoux committed
 && chown -R discourse:discourse . \
Pierre Ozoux's avatar
Pierre Ozoux committed
 && curl --silent --location https://deb.nodesource.com/setup_8.x | bash - \
 && apt-get update && apt-get install -y --no-install-recommends \
      ${BUILD_DEPS} \
Pierre Ozoux's avatar
Pierre Ozoux committed
      ghostscript \
      gsfonts \
      imagemagick \
Pierre Ozoux's avatar
Pierre Ozoux committed
      jpegoptim \
Pierre Ozoux's avatar
Pierre Ozoux committed
      libxml2 \
      nodejs \
      optipng \
Pierre Ozoux's avatar
Pierre Ozoux committed
 && npm install svgo uglify-js@"<3" -g \
Pierre Ozoux's avatar
Pierre Ozoux committed
 && 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 \
Pierre Ozoux's avatar
Pierre Ozoux committed
 && ./configure && make install \
 && cd /tmp \
 && rm gifsicle-$GIFSICLE_VERSION.tar.gz \
 && rm -rf gifsicle-$GIFSICLE_VERSION \
 && git clone -b $PNGQUANT_VERSION --single-branch https://github.com/pornel/pngquant \
 && cd pngquant \
 && make && make install \
 && rm -rf pngquant \
 && cd /home/discourse/discourse \
Pierre Ozoux's avatar
Pierre Ozoux committed
 && git remote set-branches --add origin tests-passed \
Pierre Ozoux's avatar
Pierre Ozoux committed
 && sed -i 's/daemonize true/daemonize false/g' ./config/puma.rb \
Pierre Ozoux's avatar
Pierre Ozoux committed
 && bundle config build.nokogiri --use-system-libraries \
 && bundle install --deployment --without test --without development \
 && cd /tmp \
 && curl -O https://get.enterprisedb.com/postgresql/postgresql-9.5.9-1-linux-x64-binaries.tar.gz \
 && tar zxf postgresql-9.5.9-1-linux-x64-binaries.tar.gz \
 && mv ./pgsql/bin/* /usr/local/bin/ \
 && rm postgresql-9.5.9-1-linux-x64-binaries.tar.gz \
 && rm -rf ./pgsql \
Pierre Ozoux's avatar
Pierre Ozoux committed
 && apt-get remove -y --purge ${BUILD_DEPS} \
Pierre Ozoux's avatar
Pierre Ozoux committed
 && apt-get autoremove -y \
Pierre Ozoux's avatar
Pierre Ozoux committed
 && rm -rf /var/lib/apt/lists/*

Pierre Ozoux's avatar
Pierre Ozoux committed
WORKDIR /home/discourse/discourse
Pierre Ozoux's avatar
Pierre Ozoux committed
USER discourse
Pierre Ozoux's avatar
Pierre Ozoux committed

CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]