Skip to content
Dockerfile 1.35 KiB
Newer Older
Timothee Gosselin's avatar
Timothee Gosselin committed
ARG from=discourse/base
ARG tag=slim
ARG DISCOURSE_VERSION=test-passed
Timothee Gosselin's avatar
Timothee Gosselin committed
FROM $from:$tag
Pierre Ozoux's avatar
Pierre Ozoux committed

Pierre Ozoux's avatar
Pierre Ozoux committed
    DISCOURSE_SERVE_STATIC_ASSETS=true \
unteem's avatar
unteem committed
    EMBER_CLI_PROD_ASSETS=1 \
Pierre Ozoux's avatar
Pierre Ozoux committed
    RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 \
    RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 \
    RUBY_GC_HEAP_INIT_SLOTS=400000 \
    RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 \
Timothee Gosselin's avatar
Timothee Gosselin committed
    RUBY_GC_MALLOC_LIMIT=90000000
Timothee Gosselin's avatar
Timothee Gosselin committed
# jq needed to create kubernetes CM
RUN apt-get update && apt-get install -y jq
Timothee Gosselin's avatar
Timothee Gosselin committed
WORKDIR /var/www/discourse
Timothee Gosselin's avatar
Timothee Gosselin committed

Timothee Gosselin's avatar
Timothee Gosselin committed
RUN git remote set-branches --add origin ${DISCOURSE_VERSION} &&\
    git fetch --depth 1 origin ${DISCOURSE_VERSION} &&\
    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 4 &&\
    sudo -u discourse yarn install --production &&\
    sudo -u discourse yarn cache clean &&\
    bundle exec rake maxminddb:get &&\
    find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} + &&\
    chown -R discourse:discourse /var/www/discourse
Pierre Ozoux's avatar
Pierre Ozoux committed

Timothee Gosselin's avatar
Timothee Gosselin committed
COPY install /tmp/install
Pierre Ozoux's avatar
Pierre Ozoux committed
USER discourse
Pierre Ozoux's avatar
Pierre Ozoux committed

Timothee Gosselin's avatar
Timothee Gosselin committed
RUN cd /var/www/discourse/plugins \
 && for plugin in $(cat /tmp/install/plugin-list); do \
      git clone $plugin; \
    done

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