commit 0a537bae2415451094cb9a08e130160d860bc1b2 Author: Quentin BOUTEILLER Date: Mon Apr 10 21:45:37 2023 +0200 First release of my Akkoma Docker image diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..59fde17 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +FROM alpine:3.17 + +ENV MIX_ENV prod +ENV PATH "${PATH}:/opt/akkoma/bin" +ENV AKKOMA_CONFIG_PATH "/config/config.exs" + +# Install required (and optional) packages +RUN awk 'NR==2' /etc/apk/repositories | sed 's/main/community/' | tee -a /etc/apk/repositories && \ + apk update && \ + apk add su-exec curl unzip ncurses file-dev imagemagick ffmpeg exiftool libcrypto1.1 + +# Set entrypoint +COPY ./entrypoint.sh /entrypoint.sh +RUN chown root:root /entrypoint.sh && \ + chmod u+x /entrypoint.sh + +# Create a dedicated user for Akkoma +RUN adduser --system --shell /bin/false --home /opt/akkoma akkoma + +# Clone the release build into a temporary directory and unpack it +# then move the release to the home directory and delete temporary files +RUN curl 'https://akkoma-updates.s3-website.fr-par.scw.cloud/stable/akkoma-amd64-musl.zip' -o /tmp/akkoma.zip && \ + unzip /tmp/akkoma.zip -d /tmp/ && \ + mv /tmp/release/* /opt/akkoma && \ + rmdir /tmp/release && \ + rm /tmp/akkoma.zip && \ + chown akkoma -R /opt/akkoma + +VOLUME /data +VOLUME /config + +WORKDIR /opt/akkoma + +EXPOSE 4000 + +ENTRYPOINT [ "/entrypoint.sh" ] +CMD [ "pleroma", "start" ] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..6a283b3 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,21 @@ +#!/bin/sh +set -e + +if [ "$1" = 'pleroma' ] || [ "$1" = 'pleroma_ctl' ] +then + + mkdir -p /data/{uploads,static} + mkdir -p /config + chown -R akkoma /data /config + + echo $0: executing \"pleroma_ctl migrate\" + + pleroma_ctl migrate + + echo $0: executing \"$@\" + + exec su-exec akkoma "$@" + +fi + +exec "$@"