Dockerfile 2.3 KB

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