docker/mastodon/Dockerfile.arm64v8
2020-02-15 20:01:19 -06:00

52 lines
1.5 KiB
Docker

FROM arm64v8/ruby:2.7-alpine
# Set up git remote
ARG TAG
ARG GIT_REPOSITORY
ARG BUILD_DATE
# Tell rails to serve static files
ENV RAILS_SERVE_STATIC_FILES="true"
ENV RAILS_ENV="production"
ENV NODE_ENV="production"
# Install helper scripts
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 && \
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 -h /opt/mastodon -u 991 -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 ${TAG} ${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:1.17.2 && \
bundle config set deployment 'true' && \
bundle install -j$(nproc) --without development test --with production && \
yarn install --pure-lockfile
# Compile assets
RUN OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder \
bundle exec rake assets:precompile
ENTRYPOINT ["/sbin/tini", "--"]