# Pleroma publishes no image, so this is its OTP release on the Ubuntu it is built for (24.04 for 2.10). The "stable"
# zip moves; the checksum pins 2.10.2 and fails the build when stable has moved on. Its image handling (vix) needs libvips.
FROM docker.io/library/ubuntu:24.04
ARG PLEROMA_ZIP=https://git.pleroma.social/api/packages/pleroma/generic/pleroma-otp-stable-amd64/latest/pleroma.zip
ARG PLEROMA_SHA256=5b6ab701685c1254145e33426d8775d4e159b5a17cc54a8c45d81ae0d9adc0b5
RUN apt-get update \
	&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
		ca-certificates curl unzip libncurses6 libmagic1 libmagic-mgc file postgresql-client libimage-exiftool-perl ffmpeg imagemagick libvips42t64 \
	&& rm -rf /var/lib/apt/lists/*
RUN curl -fsSL "$PLEROMA_ZIP" -o /tmp/pleroma.zip \
	&& echo "$PLEROMA_SHA256  /tmp/pleroma.zip" | sha256sum -c - \
	&& unzip -q /tmp/pleroma.zip -d /tmp && mv /tmp/release /opt/pleroma && rm /tmp/pleroma.zip \
	&& mkdir -p /var/lib/pleroma/uploads /var/lib/pleroma/static /etc/pleroma
ENV PLEROMA_CONFIG_PATH=/etc/pleroma/config.exs LANG=C.UTF-8 ELIXIR_ERL_OPTIONS=+fnu
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
