]> Untitled Git - lemmy.git/blob - docker/pleroma/Dockerfile
Add docker setup for testing Pleroma federation
[lemmy.git] / docker / pleroma / Dockerfile
1 # Pleroma Docker setup taken from
2 # https://github.com/jordemort/docker-pleroma
3
4 FROM ubuntu:20.04 AS unzip
5
6 ENV DEBIAN_FRONTEND=noninteractive
7
8 RUN apt-get update && \
9     apt-get install -y --no-install-recommends unzip
10
11 # docker buildx will fill these in
12 ARG TARGETARCH=amd64
13 ARG TARGETVARIANT=
14
15 # Clone the release build into a temporary directory and unpack it
16 # We use ADD here to bust the cache if the pleroma release changes
17 # We use a separate layer for extraction so we don't end up with junk
18 # from ADD left over in the final image.
19 ADD https://git.pleroma.social/api/v4/projects/2/jobs/artifacts/stable/download?job=${TARGETARCH}${TARGETVARIANT:+${TARGETVARIANT}l} /tmp/pleroma.zip
20
21 RUN mkdir -p /opt/pleroma && \
22     unzip /tmp/pleroma.zip -d /tmp/ && \
23     mv /tmp/release/* /opt/pleroma
24
25 # Ok, really build the container now
26 FROM ubuntu:20.04 AS pleroma
27
28 ENV DEBIAN_FRONTEND=noninteractive
29
30 ARG SOAPBOXVERSION=1.2.3
31
32 RUN apt-get update && \
33     apt-get install -y --no-install-recommends \
34       ca-certificates curl dumb-init ffmpeg gnupg imagemagick libimage-exiftool-perl libmagic-dev libncurses5 locales postgresql-client-12 unzip && \
35     apt-get clean
36
37 RUN echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen && \
38     locale-gen
39
40 ENV LANG en_US.UTF-8
41 ENV LANGUAGE en_US:en
42 ENV LC_ALL en_US.UTF-8
43
44 RUN mkdir -p /etc/pleroma /var/lib/pleroma/static /var/lib/pleroma/uploads && \
45     adduser --system --shell /bin/false --home /opt/pleroma --group pleroma && \
46     chown -vR pleroma /etc/pleroma /var/lib/pleroma
47
48 COPY --chown=pleroma:pleroma --from=unzip /opt/pleroma/ /opt/pleroma/
49
50 VOLUME [ "/etc/pleroma", "/var/lib/pleroma/uploads", "/var/lib/pleroma/static" ]
51
52 ADD https://gitlab.com/soapbox-pub/soapbox-fe/-/jobs/artifacts/v${SOAPBOXVERSION}/download?job=build-production /tmp/soapbox-fe.zip
53 RUN chown pleroma /tmp/soapbox-fe.zip
54
55 USER pleroma
56
57 COPY run-pleroma.sh /opt/pleroma/bin/
58
59 ENTRYPOINT [ "/usr/bin/dumb-init" ]
60
61 WORKDIR /opt/pleroma
62
63 ENV PATH=/opt/pleroma/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
64 ENV PLEROMA_CONFIG_PATH=/etc/pleroma/config.exs
65
66 EXPOSE 4000
67
68 STOPSIGNAL SIGTERM
69
70 HEALTHCHECK \
71     --start-period=2m \
72     --interval=5m \
73     CMD curl --fail http://localhost:4000/api/v1/instance || exit 1
74
75 CMD [ "run-pleroma.sh" ]