Dockerfile 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. FROM ruby:2.5.0-alpine3.7
  2. LABEL maintainer="https://github.com/tootsuite/mastodon" \
  3. description="A GNU Social-compatible microblogging server"
  4. ARG UID=991
  5. ARG GID=991
  6. ENV RAILS_SERVE_STATIC_FILES=true \
  7. RAILS_ENV=production NODE_ENV=production
  8. ARG YARN_VERSION=1.3.2
  9. ARG YARN_DOWNLOAD_SHA256=6cfe82e530ef0837212f13e45c1565ba53f5199eec2527b85ecbcd88bf26821d
  10. ARG LIBICONV_VERSION=1.15
  11. ARG LIBICONV_DOWNLOAD_SHA256=ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178
  12. EXPOSE 3000 4000
  13. WORKDIR /mastodon
  14. RUN apk -U upgrade \
  15. && apk add -t build-dependencies \
  16. build-base \
  17. icu-dev \
  18. libidn-dev \
  19. libressl \
  20. libtool \
  21. postgresql-dev \
  22. protobuf-dev \
  23. python \
  24. && apk add \
  25. ca-certificates \
  26. ffmpeg \
  27. file \
  28. git \
  29. icu-libs \
  30. imagemagick \
  31. libidn \
  32. libpq \
  33. nodejs \
  34. nodejs-npm \
  35. protobuf \
  36. su-exec \
  37. tini \
  38. tzdata \
  39. && update-ca-certificates \
  40. && mkdir -p /tmp/src /opt \
  41. && wget -O yarn.tar.gz "https://github.com/yarnpkg/yarn/releases/download/v$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
  42. && echo "$YARN_DOWNLOAD_SHA256 *yarn.tar.gz" | sha256sum -c - \
  43. && tar -xzf yarn.tar.gz -C /tmp/src \
  44. && rm yarn.tar.gz \
  45. && mv /tmp/src/yarn-v$YARN_VERSION /opt/yarn \
  46. && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
  47. && wget -O libiconv.tar.gz "https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$LIBICONV_VERSION.tar.gz" \
  48. && echo "$LIBICONV_DOWNLOAD_SHA256 *libiconv.tar.gz" | sha256sum -c - \
  49. && tar -xzf libiconv.tar.gz -C /tmp/src \
  50. && rm libiconv.tar.gz \
  51. && cd /tmp/src/libiconv-$LIBICONV_VERSION \
  52. && ./configure --prefix=/usr/local \
  53. && make -j$(getconf _NPROCESSORS_ONLN)\
  54. && make install \
  55. && libtool --finish /usr/local/lib \
  56. && cd /mastodon \
  57. && rm -rf /tmp/* /var/cache/apk/*
  58. COPY Gemfile Gemfile.lock package.json yarn.lock .yarnclean /mastodon/
  59. RUN bundle config build.nokogiri --with-iconv-lib=/usr/local/lib --with-iconv-include=/usr/local/include \
  60. && bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without test development \
  61. && yarn --pure-lockfile \
  62. && yarn cache clean
  63. RUN addgroup -g ${GID} mastodon && adduser -h /mastodon -s /bin/sh -D -G mastodon -u ${UID} mastodon
  64. COPY --chown=mastodon:mastodon . /mastodon
  65. VOLUME /mastodon/public/system /mastodon/public/assets /mastodon/public/packs
  66. USER mastodon
  67. ENTRYPOINT ["/sbin/tini", "--"]