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.

Dockerfile 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. FROM node:10-alpine as node
  2. FROM ruby:2.5-alpine
  3. LABEL maintainer="https://github.com/tootsuite/mastodon" \
  4. description="Your self-hosted, globally interconnected microblogging community"
  5. ARG UID=1000
  6. ARG GID=1000
  7. ENV PATH=/mastodon/bin:$PATH \
  8. RAILS_SERVE_STATIC_FILES=true \
  9. RAILS_ENV=production \
  10. NODE_ENV=production
  11. ARG LIBICONV_VERSION=1.15
  12. ARG LIBICONV_DOWNLOAD_SHA256=ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178
  13. EXPOSE 3000 4000
  14. WORKDIR /mastodon
  15. COPY --from=node /usr/local/bin/node /usr/local/bin/node
  16. COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
  17. COPY --from=node /usr/local/bin/npm /usr/local/bin/npm
  18. COPY --from=node /opt/yarn-* /opt/yarn
  19. RUN apk -U upgrade \
  20. && apk add -t \
  21. build-dependencies \
  22. alpine-sdk \
  23. icu-dev \
  24. libidn-dev \
  25. libressl \
  26. libtool \
  27. libxml2 \
  28. libxslt \
  29. postgresql-dev \
  30. protobuf-dev \
  31. python \
  32. gmp-dev \
  33. && apk add \
  34. ca-certificates \
  35. ffmpeg \
  36. file \
  37. git \
  38. icu-libs \
  39. imagemagick \
  40. libidn \
  41. libpq \
  42. protobuf \
  43. tini \
  44. tzdata \
  45. && update-ca-certificates \
  46. && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
  47. && ln -s /opt/yarn/bin/yarnpkg /usr/local/bin/yarnpkg \
  48. && mkdir -p /tmp/src /opt \
  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. 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. USER mastodon
  64. COPY --chown=mastodon:mastodon Gemfile Gemfile.lock package.json yarn.lock .yarnclean /mastodon/
  65. RUN bundle config build.nokogiri --use-system-libraries --with-iconv-lib=/usr/local/lib --with-iconv-include=/usr/local/include \
  66. && bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without test development \
  67. && yarn install --pure-lockfile --ignore-engines \
  68. && yarn cache clean
  69. COPY --chown=mastodon:mastodon . /mastodon
  70. VOLUME /mastodon/public/system
  71. RUN OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder bundle exec rails assets:precompile
  72. ENTRYPOINT ["/sbin/tini", "--"]