2023-10-10 14:16:52 +00:00
|
|
|
FROM cloudron/base:4.2.0@sha256:46da2fffb36353ef714f97ae8e962bd2c212ca091108d768ba473078319a47f4
|
2018-10-30 15:46:13 +00:00
|
|
|
|
2020-01-06 19:21:25 +00:00
|
|
|
RUN mkdir -p /app/code /app/pkg
|
2018-10-30 15:46:13 +00:00
|
|
|
WORKDIR /app/code
|
|
|
|
|
2023-01-06 14:27:40 +00:00
|
|
|
ARG NODE_VERSION=16.18.1
|
|
|
|
RUN mkdir -p /usr/local/node-${NODE_VERSION} && \
|
|
|
|
curl -L https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz | tar zxf - --strip-components 1 -C /usr/local/node-${NODE_VERSION}
|
|
|
|
ENV PATH /usr/local/node-${NODE_VERSION}/bin:$PATH
|
|
|
|
|
2020-05-15 17:52:43 +00:00
|
|
|
RUN apt-get update && \
|
2020-12-01 17:59:25 +00:00
|
|
|
apt install -y imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file git-core \
|
|
|
|
g++ libprotobuf-dev protobuf-compiler pkg-config nodejs gcc autoconf \
|
|
|
|
bison build-essential libssl-dev libyaml-dev libreadline6-dev \
|
|
|
|
zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev \
|
|
|
|
nginx redis-server redis-tools postgresql postgresql-contrib \
|
2021-02-23 17:28:41 +00:00
|
|
|
libidn11-dev libicu-dev libjemalloc-dev && \
|
2019-07-17 21:14:32 +00:00
|
|
|
rm -rf /var/cache/apt /var/lib/apt/lists
|
2018-10-30 15:46:13 +00:00
|
|
|
|
2024-05-31 07:16:48 +00:00
|
|
|
# install rbenv since we need ruby 3.2.3
|
2022-11-14 21:31:10 +00:00
|
|
|
RUN mkdir -p /usr/local/rbenv && curl -LSs "https://github.com/rbenv/rbenv/archive/refs/tags/v1.2.0.tar.gz" | tar -xz -C /usr/local/rbenv --strip-components 1 -f -
|
|
|
|
ENV PATH /usr/local/rbenv/bin:$PATH
|
2023-10-10 14:30:15 +00:00
|
|
|
ENV RBENV_ROOT /home/cloudron/rbenv
|
2024-05-31 07:16:48 +00:00
|
|
|
RUN mkdir -p "$(rbenv root)"/plugins/ruby-build && curl -LSs "https://github.com/rbenv/ruby-build/archive/refs/tags/v20240530.1.tar.gz" | tar -xz -C "$(rbenv root)"/plugins/ruby-build --strip-components 1 -f -
|
2022-11-14 21:31:10 +00:00
|
|
|
|
|
|
|
# install specific ruby version (https://github.com/mastodon/mastodon/blob/main/Dockerfile)
|
2024-05-31 07:16:48 +00:00
|
|
|
ARG RUBY_VERSION=3.2.3
|
2022-11-14 21:31:10 +00:00
|
|
|
RUN rbenv install ${RUBY_VERSION}
|
2023-10-10 14:30:15 +00:00
|
|
|
ENV PATH ${RBENV_ROOT}/versions/${RUBY_VERSION}/bin:$PATH
|
2022-11-14 21:31:10 +00:00
|
|
|
|
2020-02-09 15:43:01 +00:00
|
|
|
RUN gem install --no-document bundler
|
2018-10-30 15:46:13 +00:00
|
|
|
|
2019-07-17 21:14:32 +00:00
|
|
|
ENV RAILS_ENV production
|
|
|
|
ENV NODE_ENV production
|
2021-05-17 08:38:18 +00:00
|
|
|
|
2024-09-30 14:10:32 +00:00
|
|
|
ARG VERSION=4.2.13
|
2021-05-17 08:38:18 +00:00
|
|
|
|
2019-07-17 21:14:32 +00:00
|
|
|
RUN curl -L https://github.com/tootsuite/mastodon/archive/v${VERSION}.tar.gz | tar -xz --strip-components 1 -f - && \
|
2022-01-20 01:08:01 +00:00
|
|
|
bundle config --local set deployment 'true' && \
|
|
|
|
bundle config --local set without 'development test' && \
|
|
|
|
bundle config --local set silence_root_warning true && \
|
|
|
|
bundle install && \
|
2023-10-10 14:30:15 +00:00
|
|
|
bundle clean --force && \
|
|
|
|
rm -rf ~/.bundle /usr/local/bundle/cache && \
|
2019-07-17 21:14:32 +00:00
|
|
|
yarn install --pure-lockfile
|
2018-10-30 15:46:13 +00:00
|
|
|
|
|
|
|
# secret keys are not built into assets, so precompiling is safe to do here
|
|
|
|
# (these variables are required by rake though)
|
|
|
|
RUN SECRET_KEY_BASE=insecure.secret_key_base OTP_SECRET=insecure.otp_secret \
|
|
|
|
bundle exec rake assets:precompile
|
|
|
|
|
2020-12-21 18:12:52 +00:00
|
|
|
# https://github.com/rubygems/bundler/issues/5245 means that bundle exec writes to Gemfile.lock
|
|
|
|
RUN ln -fs /run/mastodon/bullet.log /app/code/log/bullet.log && \
|
|
|
|
rm -rf /app/code/tmp && ln -fs /tmp/mastodon /app/code/tmp && \
|
|
|
|
mv /app/code/Gemfile.lock /app/code/Gemfile.lock.original && ln -s /run/mastodon/Gemfile.lock /app/code/Gemfile.lock
|
|
|
|
|
2019-07-17 21:14:32 +00:00
|
|
|
# add nginx config
|
2020-12-21 18:12:52 +00:00
|
|
|
RUN rm /etc/nginx/sites-enabled/* && \
|
|
|
|
ln -sf /dev/stdout /var/log/nginx/access.log && \
|
|
|
|
ln -sf /dev/stderr /var/log/nginx/error.log
|
2022-01-18 18:30:53 +00:00
|
|
|
COPY nginx_readonlyrootfs.conf /etc/nginx/conf.d/readonlyrootfs.conf
|
2019-07-17 21:14:32 +00:00
|
|
|
COPY nginx/mastodon.conf /etc/nginx/sites-available/mastodon
|
|
|
|
RUN ln -s /etc/nginx/sites-available/mastodon /etc/nginx/sites-enabled/mastodon
|
|
|
|
|
|
|
|
# add supervisor configs
|
2022-01-18 18:30:53 +00:00
|
|
|
COPY supervisor/* /etc/supervisor/conf.d/
|
2019-07-17 21:14:32 +00:00
|
|
|
RUN ln -sf /run/mastodon/supervisord.log /var/log/supervisor/supervisord.log
|
|
|
|
|
|
|
|
RUN ln -fs /app/data/env.production /app/code/.env.production
|
2018-10-30 15:46:13 +00:00
|
|
|
RUN ln -fs /app/data/system /app/code/public/system
|
2019-07-17 21:14:32 +00:00
|
|
|
|
2024-02-23 15:45:18 +00:00
|
|
|
COPY start.sh cleanup.sh config.sh env.template cache-env.sh.template /app/pkg/
|
2018-10-31 12:53:10 +00:00
|
|
|
|
2020-01-06 19:21:25 +00:00
|
|
|
CMD [ "/app/pkg/start.sh" ]
|
2018-10-30 15:46:13 +00:00
|
|
|
|