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.

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