]> cat aescling's git repositories - mastodon.git/blob - Dockerfile
Reduce chances of race conditions when processing deleted toots (#9815)
[mastodon.git] / Dockerfile
1 FROM node:8.14.0-alpine as node
2 FROM ruby:2.4.5-alpine3.8
3
4 LABEL maintainer="https://github.com/tootsuite/mastodon" \
5 description="Your self-hosted, globally interconnected microblogging community"
6
7 ARG UID=991
8 ARG GID=991
9
10 ENV PATH=/mastodon/bin:$PATH \
11 RAILS_SERVE_STATIC_FILES=true \
12 RAILS_ENV=production \
13 NODE_ENV=production
14
15 ARG LIBICONV_VERSION=1.15
16 ARG LIBICONV_DOWNLOAD_SHA256=ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178
17
18 EXPOSE 3000 4000
19
20 WORKDIR /mastodon
21
22 COPY --from=node /usr/local/bin/node /usr/local/bin/node
23 COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
24 COPY --from=node /usr/local/bin/npm /usr/local/bin/npm
25 COPY --from=node /opt/yarn-* /opt/yarn
26
27 RUN apk -U upgrade \
28 && apk add -t build-dependencies \
29 build-base \
30 icu-dev \
31 libidn-dev \
32 libressl \
33 libtool \
34 libxml2-dev \
35 libxslt-dev \
36 postgresql-dev \
37 protobuf-dev \
38 python \
39 && apk add \
40 ca-certificates \
41 ffmpeg \
42 file \
43 git \
44 icu-libs \
45 imagemagick \
46 libidn \
47 libpq \
48 libxml2 \
49 libxslt \
50 protobuf \
51 tini \
52 tzdata \
53 && update-ca-certificates \
54 && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
55 && ln -s /opt/yarn/bin/yarnpkg /usr/local/bin/yarnpkg \
56 && mkdir -p /tmp/src /opt \
57 && wget -O libiconv.tar.gz "https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$LIBICONV_VERSION.tar.gz" \
58 && echo "$LIBICONV_DOWNLOAD_SHA256 *libiconv.tar.gz" | sha256sum -c - \
59 && tar -xzf libiconv.tar.gz -C /tmp/src \
60 && rm libiconv.tar.gz \
61 && cd /tmp/src/libiconv-$LIBICONV_VERSION \
62 && ./configure --prefix=/usr/local \
63 && make -j$(getconf _NPROCESSORS_ONLN)\
64 && make install \
65 && libtool --finish /usr/local/lib \
66 && cd /mastodon \
67 && rm -rf /tmp/* /var/cache/apk/*
68
69 COPY Gemfile Gemfile.lock package.json yarn.lock .yarnclean /mastodon/
70
71 RUN bundle config build.nokogiri --use-system-libraries --with-iconv-lib=/usr/local/lib --with-iconv-include=/usr/local/include \
72 && bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without test development \
73 && yarn install --pure-lockfile --ignore-engines \
74 && yarn cache clean
75
76 RUN addgroup -g ${GID} mastodon && adduser -h /mastodon -s /bin/sh -D -G mastodon -u ${UID} mastodon \
77 && mkdir -p /mastodon/public/system /mastodon/public/assets /mastodon/public/packs \
78 && chown -R mastodon:mastodon /mastodon/public
79
80 COPY . /mastodon
81
82 RUN chown -R mastodon:mastodon /mastodon
83
84 VOLUME /mastodon/public/system
85
86 USER mastodon
87
88 RUN OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder bundle exec rails assets:precompile
89
90 ENTRYPOINT ["/sbin/tini", "--"]
This page took 0.077727 seconds and 4 git commands to generate.