X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=image%2Fbase%2FDockerfile;h=ba51a214ca5a3a3b13c865faf7f3be7959eea358;hb=c87937dc40abe2791a128b4463a6a5ceba181be4;hp=405932e4b44c9f80632d8ba36a5e58ceaedff389;hpb=1d55926aa4dc6c4d2d0a0eba9181059488b771bb;p=discourse_docker.git diff --git a/image/base/Dockerfile b/image/base/Dockerfile index 405932e..ba51a21 100644 --- a/image/base/Dockerfile +++ b/image/base/Dockerfile @@ -1,59 +1,61 @@ # NAME: discourse/base # VERSION: release -FROM ubuntu:16.04 +FROM debian:buster-slim ENV PG_MAJOR 10 ENV RUBY_ALLOCATOR /usr/lib/libjemalloc.so.1 -ENV COMPRESS_BROTLI 1 +ENV RAILS_ENV production #LABEL maintainer="Sam Saffron \"https://twitter.com/samsaffron\"" RUN echo 2.0.`date +%Y%m%d` > /VERSION -RUN apt-get update && apt-get install -y lsb-release sudo curl +RUN apt update && apt install -y gnupg sudo curl RUN echo "debconf debconf/frontend select Teletype" | debconf-set-selections -RUN echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main restricted universe" > /etc/apt/sources.list -RUN echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-updates main restricted universe" >> /etc/apt/sources.list -RUN echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-security main restricted universe" >> /etc/apt/sources.list -RUN apt-get update && apt-get -y install fping -RUN sh -c "fping proxy && echo 'Acquire { Retries \"0\"; HTTP { Proxy \"http://proxy:3128\";}; };' > /etc/apt/apt.conf.d/40proxy && apt-get update || true" -RUN apt-get -y install software-properties-common +RUN apt update && apt -y install fping +RUN sh -c "fping proxy && echo 'Acquire { Retries \"0\"; HTTP { Proxy \"http://proxy:3128\";}; };' > /etc/apt/apt.conf.d/40proxy && apt update || true" +RUN apt -y install software-properties-common RUN apt-mark hold initscripts -RUN apt-get -y upgrade -RUN curl http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add - -RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main" | \ +RUN apt -y upgrade + +RUN apt install -y locales locales-all +ENV LC_ALL en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US.UTF-8 + +RUN curl https://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add - +RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" | \ tee /etc/apt/sources.list.d/postgres.list -RUN curl --silent --location https://deb.nodesource.com/setup_8.x | sudo bash - -RUN apt-get -y update -RUN apt-get -y install build-essential git wget \ +RUN curl --silent --location https://deb.nodesource.com/setup_10.x | sudo bash - +RUN apt -y update +RUN apt -y install build-essential git wget rsync \ libxslt-dev libcurl4-openssl-dev \ libssl-dev libyaml-dev libtool \ libxml2-dev gawk parallel \ postgresql-${PG_MAJOR} postgresql-client-${PG_MAJOR} \ postgresql-contrib-${PG_MAJOR} libpq-dev libreadline-dev \ - language-pack-en cron anacron \ + cron anacron \ psmisc rsyslog vim whois brotli libunwind-dev \ libtcmalloc-minimal4 RUN sed -i -e 's/start -q anacron/anacron -s/' /etc/cron.d/anacron RUN sed -i.bak 's/$ModLoad imklog/#$ModLoad imklog/' /etc/rsyslog.conf RUN dpkg-divert --local --rename --add /sbin/initctl RUN sh -c "test -f /sbin/initctl || ln -s /bin/true /sbin/initctl" -RUN apt-get -y install redis-server haproxy openssh-server +RUN apt -y install openssh-server RUN cd / &&\ - apt-get -y install runit monit socat &&\ + apt -y install runit socat &&\ mkdir -p /etc/runit/1.d &&\ - apt-get clean &&\ + apt clean &&\ rm -f /etc/apt/apt.conf.d/40proxy &&\ locale-gen en_US &&\ - apt-get install -y nodejs &&\ - npm install -g uglify-js@"<3" &&\ - npm install -g svgo &&\ - npm install -g prettier@1.14.0 + apt install -y nodejs &&\ + npm install -g uglify-js &&\ + npm install -g svgo ADD install-nginx /tmp/install-nginx RUN /tmp/install-nginx -RUN apt-get -y install advancecomp jhead jpegoptim libjpeg-turbo-progs optipng +RUN apt -y install advancecomp jhead jpegoptim libjpeg-turbo-progs optipng RUN mkdir /jemalloc-stable && cd /jemalloc-stable &&\ wget https://github.com/jemalloc/jemalloc/releases/download/3.6.0/jemalloc-3.6.0.tar.bz2 &&\ @@ -61,21 +63,24 @@ RUN mkdir /jemalloc-stable && cd /jemalloc-stable &&\ cd / && rm -rf /jemalloc-stable RUN mkdir /jemalloc-new && cd /jemalloc-new &&\ - wget https://github.com/jemalloc/jemalloc/releases/download/5.1.0/jemalloc-5.1.0.tar.bz2 &&\ - tar -xjf jemalloc-5.1.0.tar.bz2 && cd jemalloc-5.1.0 && ./configure --prefix=/usr --with-install-suffix=5.1.0 && make build_lib && make install_lib &&\ + wget https://github.com/jemalloc/jemalloc/releases/download/5.2.0/jemalloc-5.2.0.tar.bz2 &&\ + tar -xjf jemalloc-5.2.0.tar.bz2 && cd jemalloc-5.2.0 && ./configure --prefix=/usr --with-install-suffix=5.1.0 && make build_lib && make install_lib &&\ cd / && rm -rf /jemalloc-new RUN echo 'gem: --no-document' >> /usr/local/etc/gemrc &&\ mkdir /src && cd /src && git clone https://github.com/sstephenson/ruby-build.git &&\ cd /src/ruby-build && ./install.sh &&\ - cd / && rm -rf /src/ruby-build && (ruby-build 2.5.1 /usr/local) + cd / && rm -rf /src/ruby-build && (ruby-build 2.6.5 /usr/local) RUN gem update --system RUN gem install bundler --force &&\ - rm -rf /usr/local/share/ri/2.5.1/system &&\ + rm -rf /usr/local/share/ri/2.6.5/system &&\ cd / && git clone https://github.com/discourse/pups.git +ADD install-redis /tmp/install-redis +RUN /tmp/install-redis + ADD install-imagemagick /tmp/install-imagemagick RUN /tmp/install-imagemagick @@ -91,6 +96,12 @@ RUN /tmp/install-gifsicle ADD install-pngquant /tmp/install-pngquant RUN /tmp/install-pngquant +# 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 &&\ @@ -122,7 +133,6 @@ ADD cron /etc/service/cron/run ADD rsyslog /etc/service/rsyslog/run ADD cron.d_anacron /etc/cron.d/anacron - # Discourse specific bits RUN useradd discourse -s /bin/bash -m -U &&\ mkdir -p /var/www &&\ @@ -132,6 +142,6 @@ RUN useradd discourse -s /bin/bash -m -U &&\ git remote set-branches --add origin tests-passed &&\ chown -R discourse:discourse /var/www/discourse &&\ cd /var/www/discourse &&\ - sudo -u discourse bundle install --deployment \ - --without test --without development &&\ + sudo -u discourse bundle install --deployment --jobs 4 --without test development &&\ + bundle exec rake maxminddb:get &&\ find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} +