2019-01-17 09:18:40 -06:00
|
|
|
FROM node:8.15-alpine as node
|
2019-02-04 22:11:51 -06:00
|
|
|
FROM ruby:2.6-alpine3.9
|
2016-03-14 15:39:39 -05:00
|
|
|
|
2017-04-06 13:57:16 -05:00
|
|
|
LABEL maintainer="https://github.com/tootsuite/mastodon" \
|
2018-03-06 18:57:31 -06:00
|
|
|
description="Your self-hosted, globally interconnected microblogging community"
|
2017-04-06 13:57:16 -05:00
|
|
|
|
2018-02-20 10:25:01 -06:00
|
|
|
ARG UID=991
|
|
|
|
ARG GID=991
|
|
|
|
|
2018-06-25 06:30:25 -05:00
|
|
|
ENV PATH=/mastodon/bin:$PATH \
|
|
|
|
RAILS_SERVE_STATIC_FILES=true \
|
|
|
|
RAILS_ENV=production \
|
|
|
|
NODE_ENV=production
|
2016-03-14 15:39:39 -05:00
|
|
|
|
2017-08-03 11:04:36 -05:00
|
|
|
ARG LIBICONV_VERSION=1.15
|
|
|
|
ARG LIBICONV_DOWNLOAD_SHA256=ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178
|
|
|
|
|
2017-04-06 13:57:16 -05:00
|
|
|
EXPOSE 3000 4000
|
|
|
|
|
2016-03-14 15:39:39 -05:00
|
|
|
WORKDIR /mastodon
|
|
|
|
|
2018-07-14 08:12:27 -05:00
|
|
|
COPY --from=node /usr/local/bin/node /usr/local/bin/node
|
|
|
|
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
|
|
|
|
COPY --from=node /usr/local/bin/npm /usr/local/bin/npm
|
|
|
|
COPY --from=node /opt/yarn-* /opt/yarn
|
|
|
|
|
2019-02-05 08:13:19 -06:00
|
|
|
RUN apk add --no-cache -t build-dependencies \
|
2017-05-20 13:01:05 -05:00
|
|
|
build-base \
|
2017-07-18 08:19:49 -05:00
|
|
|
icu-dev \
|
2017-07-15 21:40:56 -05:00
|
|
|
libidn-dev \
|
2019-02-05 08:12:45 -06:00
|
|
|
openssl \
|
2017-08-03 11:04:36 -05:00
|
|
|
libtool \
|
2018-12-31 21:03:54 -06:00
|
|
|
libxml2-dev \
|
|
|
|
libxslt-dev \
|
2017-05-20 13:01:05 -05:00
|
|
|
postgresql-dev \
|
|
|
|
protobuf-dev \
|
2017-04-20 06:29:38 -05:00
|
|
|
python \
|
2019-02-05 08:13:19 -06:00
|
|
|
&& apk add --no-cache \
|
2017-05-20 13:01:05 -05:00
|
|
|
ca-certificates \
|
|
|
|
ffmpeg \
|
|
|
|
file \
|
2018-03-17 09:28:09 -05:00
|
|
|
git \
|
2017-07-18 08:19:49 -05:00
|
|
|
icu-libs \
|
2017-08-30 16:52:19 -05:00
|
|
|
imagemagick \
|
2017-07-15 21:40:56 -05:00
|
|
|
libidn \
|
2017-04-02 17:46:44 -05:00
|
|
|
libpq \
|
2018-12-31 21:03:54 -06:00
|
|
|
libxml2 \
|
|
|
|
libxslt \
|
Use CLD3 (#2949)
Compact Language Detector v3 (CLD3) is the successor of CLD2, which was
used in the previous implementation. CLD3 includes improvements since CLD2,
and supports newer compilers. On the other hand, it has additional
requirements and cld3-ruby, the FFI of CLD3 for Ruby, is still new and may
be still inmature.
Though CLD3 is named after CLD2, it is implemented with a neural network
model, different from the old implementation, which is based on a Naïve
Bayesian classifier.
CLD3 supports newer compilers, such as GCC 6. CLD2 is not compatible with
GCC 6 because it assigns negative values to varibales typed unsigned.
(see internal/cld_generated_cjk_uni_prop_80.cc) The support for GCC 6 and
newer compilers are essential today, when some server operating system
such as Ubuntu Server 16.10 has GCC 6 by default.
On the one hand, CLD3 requires C++11 support. Environments with old
compilers such as Ubuntu Server 14.04 needs to update the system or install
a newer compiler.
CLD3 needs protocol buffers as a new dependency. However,it is not
considered problematic because major server operating systems, CentOS and
Ubuntu Server provide them.
The FFI cld3-ruby was written by me (Akihiko Odaki) for use in Mastodon.
It is still new and may be inmature, but confirmed to pass existing tests.
2017-05-09 12:58:03 -05:00
|
|
|
protobuf \
|
2017-05-20 13:01:05 -05:00
|
|
|
tini \
|
2018-01-19 12:11:19 -06:00
|
|
|
tzdata \
|
2017-04-22 21:59:56 -05:00
|
|
|
&& update-ca-certificates \
|
2018-03-17 08:06:25 -05:00
|
|
|
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
|
2018-06-26 13:34:01 -05:00
|
|
|
&& ln -s /opt/yarn/bin/yarnpkg /usr/local/bin/yarnpkg \
|
2018-07-14 08:12:27 -05:00
|
|
|
&& mkdir -p /tmp/src /opt \
|
2017-11-17 11:21:05 -06:00
|
|
|
&& wget -O libiconv.tar.gz "https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$LIBICONV_VERSION.tar.gz" \
|
2017-08-03 11:04:36 -05:00
|
|
|
&& echo "$LIBICONV_DOWNLOAD_SHA256 *libiconv.tar.gz" | sha256sum -c - \
|
|
|
|
&& tar -xzf libiconv.tar.gz -C /tmp/src \
|
|
|
|
&& rm libiconv.tar.gz \
|
|
|
|
&& cd /tmp/src/libiconv-$LIBICONV_VERSION \
|
|
|
|
&& ./configure --prefix=/usr/local \
|
2017-08-07 11:55:07 -05:00
|
|
|
&& make -j$(getconf _NPROCESSORS_ONLN)\
|
2017-08-03 11:04:36 -05:00
|
|
|
&& make install \
|
|
|
|
&& libtool --finish /usr/local/lib \
|
|
|
|
&& cd /mastodon \
|
2019-02-05 08:13:19 -06:00
|
|
|
&& rm -rf /tmp/*
|
2016-03-16 05:18:09 -05:00
|
|
|
|
2017-09-30 15:05:24 -05:00
|
|
|
COPY Gemfile Gemfile.lock package.json yarn.lock .yarnclean /mastodon/
|
2017-12-21 18:07:02 -06:00
|
|
|
COPY stack-fix.c /lib
|
|
|
|
RUN gcc -shared -fPIC /lib/stack-fix.c -o /lib/stack-fix.so
|
|
|
|
RUN rm /lib/stack-fix.c
|
2017-05-02 19:04:16 -05:00
|
|
|
|
2018-12-31 21:03:54 -06:00
|
|
|
RUN bundle config build.nokogiri --use-system-libraries --with-iconv-lib=/usr/local/lib --with-iconv-include=/usr/local/include \
|
2017-08-07 11:55:07 -05:00
|
|
|
&& bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without test development \
|
2018-07-13 20:56:41 -05:00
|
|
|
&& yarn install --pure-lockfile --ignore-engines \
|
2017-09-30 15:05:24 -05:00
|
|
|
&& yarn cache clean
|
2017-05-02 19:04:16 -05:00
|
|
|
|
2018-03-05 09:45:09 -06:00
|
|
|
RUN addgroup -g ${GID} mastodon && adduser -h /mastodon -s /bin/sh -D -G mastodon -u ${UID} mastodon \
|
|
|
|
&& mkdir -p /mastodon/public/system /mastodon/public/assets /mastodon/public/packs \
|
|
|
|
&& chown -R mastodon:mastodon /mastodon/public
|
2017-05-20 08:12:29 -05:00
|
|
|
|
2018-03-06 18:57:31 -06:00
|
|
|
COPY . /mastodon
|
|
|
|
|
|
|
|
RUN chown -R mastodon:mastodon /mastodon
|
2017-05-20 08:12:29 -05:00
|
|
|
|
2018-07-14 18:19:09 -05:00
|
|
|
VOLUME /mastodon/public/system
|
2017-05-20 08:12:29 -05:00
|
|
|
|
2018-02-20 10:25:01 -06:00
|
|
|
USER mastodon
|
|
|
|
|
2018-03-23 12:09:22 -05:00
|
|
|
ENV LD_PRELOAD=/lib/stack-fix.so
|
2018-07-14 18:19:09 -05:00
|
|
|
RUN OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder bundle exec rails assets:precompile
|
|
|
|
|
2018-02-20 10:25:01 -06:00
|
|
|
ENTRYPOINT ["/sbin/tini", "--"]
|