First release of my Akkoma Docker image

This commit is contained in:
Quentin Bouteiller 2023-04-10 21:45:37 +02:00
commit 0a537bae24
2 changed files with 58 additions and 0 deletions

37
Dockerfile Normal file
View File

@ -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" ]

21
entrypoint.sh Normal file
View File

@ -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 "$@"