闭社主体 forked from https://github.com/tootsuite/mastodon
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.

87 lines
2.6 KiB

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