mastodon-actions/Dockerfile

51 lines
1.6 KiB
Docker
Raw Normal View History

2024-02-14 19:02:19 +00:00
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 \
2024-02-14 22:06:43 +00:00
readline-dev postgresql-dev curl tini python3 shared-mime-info gcompat && \
2024-02-14 19:02:19 +00:00
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
2024-02-14 20:57:49 +00:00
WORKDIR /opt
ADD ${GIT_REPOSITORY}/archive/${GIT_BRANCH}.tar.gz /opt/mastodon.tar.gz
RUN tar -zxf mastodon.tar.gz && \
2024-02-14 21:09:37 +00:00
chown -R ${UID}:${GID} mastodon && \
rm mastodon.tar.gz
2024-02-14 19:02:19 +00:00
# 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
2024-02-15 00:24:18 +00:00
COPY --chown=${UID}:${GID} public/ /opt/mastodon/public/
2024-02-14 19:02:19 +00:00
ENTRYPOINT ["/sbin/tini", "--"]