add pleroma_source_selfbuilt image for patching pleroma

This commit is contained in:
Luna 2023-01-22 18:49:46 -03:00
parent 66f16288fc
commit 8c9f487412
3 changed files with 63 additions and 1 deletions

46
Dockerfile.pleroma-source Normal file
View file

@ -0,0 +1,46 @@
FROM elixir:1.11.4-alpine
ARG PLEROMA_VER=develop
ARG UID=911
ARG GID=911
ENV MIX_ENV=prod
RUN echo "http://nl.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories \
&& apk update \
&& apk add git gcc g++ musl-dev make cmake file-dev \
exiftool imagemagick libmagic ncurses postgresql-client ffmpeg
RUN addgroup -g ${GID} pleroma \
&& adduser -h /pleroma -s /bin/false -D -G pleroma -u ${UID} pleroma
ARG DATA=/var/lib/pleroma
RUN mkdir -p /etc/pleroma \
&& chown -R pleroma /etc/pleroma \
&& mkdir -p ${DATA}/uploads \
&& mkdir -p ${DATA}/static \
&& chown -R pleroma ${DATA}
USER pleroma
WORKDIR /pleroma
RUN git clone -b develop https://git.pleroma.social/pleroma/pleroma.git /pleroma \
&& git checkout ${PLEROMA_VER}
USER root
COPY ./minica.pem /usr/local/share/ca-certificates/minica.crt
RUN update-ca-certificates
USER pleroma
RUN mix local.hex --force \
&& mix local.rebar --force \
&& mix deps.get --only prod \
&& mix deps.compile --only prod \
&& mix compile --only prod
COPY ./files/pleroma.exs config/prod.secret.exs
COPY ./files/pleroma_source_entrypoint.sh docker-entrypoint.sh
EXPOSE 4000
ENTRYPOINT ["/pleroma/docker-entrypoint.sh"]

View file

@ -0,0 +1,14 @@
#!/bin/ash
set -eux
echo "-- Waiting for database..."
while ! pg_isready -U ${DB_USER:-pleroma} -d postgres://${DB_HOST:-db}:${DB_PORT:-5432}/${DB_NAME:-pleroma} -t 1; do
sleep 1s
done
echo "-- Running migrations..."
mix ecto.migrate
echo "-- Starting!"
mix phx.server

View file

@ -2,9 +2,10 @@
# #
# setup pleroma db # setup pleroma db
set -eux
docker-compose up -d pleroma_db docker-compose up -d pleroma_db
docker-compose up -d pleroma2_db docker-compose up -d pleroma2_db
sleep 10 sleep 10 # waiting for databases to warm up
docker-compose exec -i pleroma_db psql -U pleroma -c "CREATE EXTENSION IF NOT EXISTS citext;" docker-compose exec -i pleroma_db psql -U pleroma -c "CREATE EXTENSION IF NOT EXISTS citext;"
docker-compose exec -i pleroma_db psql -U pleroma -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;" docker-compose exec -i pleroma_db psql -U pleroma -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
docker-compose exec -i pleroma_db psql -U pleroma -c 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp";' docker-compose exec -i pleroma_db psql -U pleroma -c 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp";'
@ -14,3 +15,4 @@ docker-compose exec -i pleroma2_db psql -U pleroma -c 'CREATE EXTENSION IF NOT E
docker-compose down docker-compose down
docker buildx build -t pleroma_selfbuilt -f ./Dockerfile.pleroma . docker buildx build -t pleroma_selfbuilt -f ./Dockerfile.pleroma .
docker buildx build -t pleroma_source_selfbuilt -f ./Dockerfile.pleroma-source .