docker-mastodon/Dockerfile

90 lines
2.4 KiB
Docker
Raw Normal View History

2019-03-11 21:06:00 +00:00
FROM ruby:2.6.1-alpine3.9
2018-06-12 14:54:14 +00:00
2019-06-15 15:24:56 +00:00
ARG VERSION=v2.9.0
2018-06-12 14:54:14 +00:00
ARG REPOSITORY=tootsuite/mastodon
ARG LIBICONV_VERSION=1.15
ENV UID=991 GID=991 \
RUN_DB_MIGRATIONS=true \
SIDEKIQ_WORKERS=5 \
RAILS_SERVE_STATIC_FILES=true \
RAILS_ENV=production \
NODE_ENV=production \
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mastodon/bin
WORKDIR /mastodon
# Install dependencies
RUN apk -U upgrade \
&& apk add \
ca-certificates \
ffmpeg \
file \
git \
icu-libs \
imagemagick \
libidn \
2019-03-11 21:06:00 +00:00
libxml2 \
libxslt \
2018-06-12 14:54:14 +00:00
libpq \
nodejs \
2019-03-11 21:06:00 +00:00
npm \
openssl \
2018-06-12 14:54:14 +00:00
protobuf \
s6 \
su-exec \
tzdata \
# Install build dependencies
&& apk add -t build-dependencies \
build-base \
icu-dev \
libidn-dev \
libtool \
2019-03-11 21:06:00 +00:00
libxml2-dev \
libxslt-dev \
2018-06-12 14:54:14 +00:00
postgresql-dev \
protobuf-dev \
python \
tar \
yarn \
# Update CA certificates
&& update-ca-certificates \
# Install GNU Libiconv
&& wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${LIBICONV_VERSION}.tar.gz -O /tmp/libiconv-${LIBICONV_VERSION}.tar.gz \
&& mkdir /tmp/src && tar xzf /tmp/libiconv-${LIBICONV_VERSION}.tar.gz -C /tmp/src \
&& cd /tmp/src/libiconv-${LIBICONV_VERSION} \
&& ./configure --prefix=/usr/local \
&& make -j$(getconf _NPROCESSORS_ONLN) && make install && libtool --finish /usr/local/lib \
# Install Mastodon
&& cd /mastodon \
&& wget -qO- https://github.com/${REPOSITORY}/archive/${VERSION}.tar.gz | tar xz --strip 1 \
2019-03-11 21:06:00 +00:00
&& bundle config build.nokogiri --use-system-libraries --with-iconv-lib=/usr/local/lib --with-iconv-include=/usr/local/include \
2018-06-12 14:54:14 +00:00
&& bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --clean --no-cache --without test development \
2019-03-11 21:06:00 +00:00
&& yarn install --pure-lockfile --ignore-engines \
2018-06-12 14:54:14 +00:00
# Precompile Mastodon assets
2019-03-11 21:06:00 +00:00
&& OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder bundle exec rails assets:precompile \
2018-06-12 14:54:14 +00:00
# Clean
&& npm -g --force cache clean && yarn cache clean \
&& apk del build-dependencies \
&& rm -rf /var/cache/apk/* /tmp/src
COPY rootfs /
RUN chmod +x /usr/local/bin/* /etc/s6.d/*/* /etc/s6.d/.s6-svscan/*
VOLUME /mastodon/public/system /mastodon/log
EXPOSE 3000 4000
LABEL maintainer="Wonderfall <wonderfall@targaryen.house>" \
description="Your self-hosted, globally interconnected microblogging community"
ENTRYPOINT ["/usr/local/bin/run"]
CMD ["/bin/s6-svscan", "/etc/s6.d"]