You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.5 KiB

  1. FROM ruby:2.5.0-alpine3.7
  2. LABEL maintainer="https://github.com/tootsuite/mastodon" \
  3. description="Your self-hosted, globally interconnected microblogging community"
  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.5.1
  9. ARG YARN_DOWNLOAD_SHA256=cd31657232cf48d57fdbff55f38bfa058d2fb4950450bd34af72dac796af4de1
  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. icu-libs \
  29. imagemagick \
  30. libidn \
  31. libpq \
  32. nodejs \
  33. protobuf \
  34. tini \
  35. tzdata \
  36. && update-ca-certificates \
  37. && mkdir -p /tmp/src /opt \
  38. && wget -O yarn.tar.gz "https://github.com/yarnpkg/yarn/releases/download/v$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
  39. && echo "$YARN_DOWNLOAD_SHA256 *yarn.tar.gz" | sha256sum -c - \
  40. && tar -xzf yarn.tar.gz -C /tmp/src \
  41. && rm yarn.tar.gz \
  42. && mv /tmp/src/yarn-v$YARN_VERSION /opt/yarn \
  43. && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
  44. && wget -O libiconv.tar.gz "https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$LIBICONV_VERSION.tar.gz" \
  45. && echo "$LIBICONV_DOWNLOAD_SHA256 *libiconv.tar.gz" | sha256sum -c - \
  46. && tar -xzf libiconv.tar.gz -C /tmp/src \
  47. && rm libiconv.tar.gz \
  48. && cd /tmp/src/libiconv-$LIBICONV_VERSION \
  49. && ./configure --prefix=/usr/local \
  50. && make -j$(getconf _NPROCESSORS_ONLN)\
  51. && make install \
  52. && libtool --finish /usr/local/lib \
  53. && cd /mastodon \
  54. && rm -rf /tmp/* /var/cache/apk/*
  55. COPY Gemfile Gemfile.lock package.json yarn.lock .yarnclean /mastodon/
  56. RUN bundle config build.nokogiri --with-iconv-lib=/usr/local/lib --with-iconv-include=/usr/local/include \
  57. && bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without test development \
  58. && yarn --pure-lockfile \
  59. && yarn cache clean
  60. RUN addgroup -g ${GID} mastodon && adduser -h /mastodon -s /bin/sh -D -G mastodon -u ${UID} mastodon \
  61. && mkdir -p /mastodon/public/system /mastodon/public/assets /mastodon/public/packs \
  62. && chown -R mastodon:mastodon /mastodon/public
  63. COPY . /mastodon
  64. RUN chown -R mastodon:mastodon /mastodon
  65. VOLUME /mastodon/public/system /mastodon/public/assets /mastodon/public/packs
  66. USER mastodon
  67. ENTRYPOINT ["/sbin/tini", "--"]