2018-01-20 06:53:30 +11:00
|
|
|
FROM ruby:2.5.0-alpine3.7
|
2016-03-15 07:39:39 +11:00
|
|
|
|
2017-04-07 04:57:16 +10:00
|
|
|
LABEL maintainer="https://github.com/tootsuite/mastodon" \
|
|
|
|
description="A GNU Social-compatible microblogging server"
|
|
|
|
|
2018-02-21 03:25:01 +11:00
|
|
|
ARG UID=991
|
|
|
|
ARG GID=991
|
|
|
|
|
|
|
|
ENV RAILS_SERVE_STATIC_FILES=true \
|
2017-05-20 23:12:29 +10:00
|
|
|
RAILS_ENV=production NODE_ENV=production
|
2016-03-15 07:39:39 +11:00
|
|
|
|
2017-12-06 21:42:51 +11:00
|
|
|
ARG YARN_VERSION=1.3.2
|
|
|
|
ARG YARN_DOWNLOAD_SHA256=6cfe82e530ef0837212f13e45c1565ba53f5199eec2527b85ecbcd88bf26821d
|
2017-08-04 02:04:36 +10:00
|
|
|
ARG LIBICONV_VERSION=1.15
|
|
|
|
ARG LIBICONV_DOWNLOAD_SHA256=ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178
|
|
|
|
|
2017-04-07 04:57:16 +10:00
|
|
|
EXPOSE 3000 4000
|
|
|
|
|
2016-03-15 07:39:39 +11:00
|
|
|
WORKDIR /mastodon
|
|
|
|
|
2017-08-31 07:52:19 +10:00
|
|
|
RUN apk -U upgrade \
|
2017-05-21 04:01:05 +10:00
|
|
|
&& apk add -t build-dependencies \
|
|
|
|
build-base \
|
2017-07-18 23:19:49 +10:00
|
|
|
icu-dev \
|
2017-07-16 12:40:56 +10:00
|
|
|
libidn-dev \
|
2017-09-28 12:51:36 +10:00
|
|
|
libressl \
|
2017-08-04 02:04:36 +10:00
|
|
|
libtool \
|
2017-05-21 04:01:05 +10:00
|
|
|
postgresql-dev \
|
|
|
|
protobuf-dev \
|
2017-04-20 21:29:38 +10:00
|
|
|
python \
|
2017-05-21 04:01:05 +10:00
|
|
|
&& apk add \
|
|
|
|
ca-certificates \
|
|
|
|
ffmpeg \
|
|
|
|
file \
|
2017-05-03 10:04:16 +10:00
|
|
|
git \
|
2017-07-18 23:19:49 +10:00
|
|
|
icu-libs \
|
2017-08-31 07:52:19 +10:00
|
|
|
imagemagick \
|
2017-07-16 12:40:56 +10:00
|
|
|
libidn \
|
2017-04-03 08:46:44 +10:00
|
|
|
libpq \
|
2017-08-31 07:52:19 +10:00
|
|
|
nodejs \
|
2017-09-28 12:51:36 +10:00
|
|
|
nodejs-npm \
|
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-10 03:58:03 +10:00
|
|
|
protobuf \
|
2017-05-20 23:12:29 +10:00
|
|
|
su-exec \
|
2017-05-21 04:01:05 +10:00
|
|
|
tini \
|
2018-01-20 05:11:19 +11:00
|
|
|
tzdata \
|
2017-04-23 12:59:56 +10:00
|
|
|
&& update-ca-certificates \
|
2017-09-28 12:51:36 +10:00
|
|
|
&& mkdir -p /tmp/src /opt \
|
|
|
|
&& wget -O yarn.tar.gz "https://github.com/yarnpkg/yarn/releases/download/v$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
|
|
|
|
&& echo "$YARN_DOWNLOAD_SHA256 *yarn.tar.gz" | sha256sum -c - \
|
|
|
|
&& tar -xzf yarn.tar.gz -C /tmp/src \
|
|
|
|
&& rm yarn.tar.gz \
|
|
|
|
&& mv /tmp/src/yarn-v$YARN_VERSION /opt/yarn \
|
|
|
|
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
|
2017-11-18 04:21:05 +11:00
|
|
|
&& wget -O libiconv.tar.gz "https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$LIBICONV_VERSION.tar.gz" \
|
2017-08-04 02:04:36 +10: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-08 02:55:07 +10:00
|
|
|
&& make -j$(getconf _NPROCESSORS_ONLN)\
|
2017-08-04 02:04:36 +10:00
|
|
|
&& make install \
|
|
|
|
&& libtool --finish /usr/local/lib \
|
|
|
|
&& cd /mastodon \
|
2017-04-03 08:46:44 +10:00
|
|
|
&& rm -rf /tmp/* /var/cache/apk/*
|
2016-03-16 21:18:09 +11:00
|
|
|
|
2017-10-01 07:05:24 +11:00
|
|
|
COPY Gemfile Gemfile.lock package.json yarn.lock .yarnclean /mastodon/
|
2017-05-03 10:04:16 +10:00
|
|
|
|
2017-08-04 02:04:36 +10:00
|
|
|
RUN bundle config build.nokogiri --with-iconv-lib=/usr/local/lib --with-iconv-include=/usr/local/include \
|
2017-08-08 02:55:07 +10:00
|
|
|
&& bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without test development \
|
2017-10-01 07:05:24 +11:00
|
|
|
&& yarn --pure-lockfile \
|
|
|
|
&& yarn cache clean
|
2017-05-03 10:04:16 +10:00
|
|
|
|
2018-03-06 02:45:09 +11: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 23:12:29 +10:00
|
|
|
|
2018-02-21 05:11:36 +11:00
|
|
|
COPY --chown=mastodon:mastodon . /mastodon
|
2017-05-20 23:12:29 +10:00
|
|
|
|
2017-05-03 10:04:16 +10:00
|
|
|
VOLUME /mastodon/public/system /mastodon/public/assets /mastodon/public/packs
|
2017-05-20 23:12:29 +10:00
|
|
|
|
2018-02-21 03:25:01 +11:00
|
|
|
USER mastodon
|
|
|
|
|
|
|
|
ENTRYPOINT ["/sbin/tini", "--"]
|