mastodon-actions/Dockerfile

49 lines
1.5 KiB
Docker

FROM ruby:3.2-alpine3.19
ARG GIT_BRANCH
ARG GIT_REPOSITORY
ENV RAILS_SERVE_STATIC_FILES="true"
ENV RAILS_ENV="production"
ENV NODE_ENV="production"
COPY root/ /
# Install build dependencies
RUN apk add --no-cache whois nodejs yarn ca-certificates git bash \
gcc g++ make libc-dev file sed \
imagemagick protobuf-dev libpq ffmpeg icu-dev libidn-dev yaml-dev \
readline-dev postgresql-dev curl tini python3 shared-mime-info && \
update-ca-certificates
# Create the mastodon user
ARG UID=1001
ARG GID=1001
RUN echo "Etc/UTC" > /etc/localtime && \
mkdir -p /opt/mastodon && \
addgroup --gid $GID mastodon && \
adduser -D -u $UID -G mastodon -h /opt/mastodon mastodon && \
echo "mastodon:`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 | mkpasswd -s -m sha-256`" | chpasswd && \
chown -R mastodon:mastodon /opt/mastodon
# Install mastodon
USER mastodon
RUN git clone -b ${GIT_BRANCH} ${GIT_REPOSITORY} /opt/mastodon && \
rm -rf /opt/mastodon/.git
# Install dependencies
WORKDIR /opt/mastodon
RUN mkdir -p /opt/mastodon/.config/yarn/global && \
touch /opt/mastodon/.config/yarn/global/.yarnclean && \
gem install bundler && \
bundle config set --local deployment 'true' && \
bundle config set --local without 'development test' && \
bundle config set silence_root_warning 'true' && \
bundle install -j$(nproc) && \
yarn install --pure-lockfile --production --network-timeout=30000
# Copy compiled assets
COPY --chown=991:991 pubilc/ public/
ENTRYPOINT ["/sbin/tini", "--"]