main
Ricard Illa 2021-02-23 19:28:50 +01:00
parent 8cbfc253ab
commit dd55fd65a5
5 changed files with 92 additions and 1 deletions

View File

@ -1,4 +1,4 @@
images=agate archivebox ansible backup buku ddclient git-daemon gitolite gitolite-pystagit rss-bridge sassc syncthing tasks tor vdirsyncer xandikos images=agate archivebox ansible backup buku ddclient git-daemon gitolite gitolite-pystagit rss-bridge pleroma sassc syncthing tasks tor vdirsyncer xandikos
.PHONY: all $(images) .PHONY: all $(images)
all: $(images) all: $(images)
@ -34,6 +34,9 @@ gitolite-pystagit:
rss-bridge: rss-bridge:
$(BUILD) $(BUILD)
pleroma:
$(BUILD)
sassc: sassc:
$(BUILD) $(BUILD)

View File

@ -27,6 +27,7 @@ useful.
* gitolite-pystagit: well, gitolite + pystagit * gitolite-pystagit: well, gitolite + pystagit
* gitolite: gitolite + docker, so that I can mount the docker socket inside of * gitolite: gitolite + docker, so that I can mount the docker socket inside of
it and have it do useful things through docker in response to triggers it and have it do useful things through docker in response to triggers
* pleroma
* sassc * sassc
* syncthing * syncthing
* tasks: intended to run a cron daemon to run arbitrary periodic tasks. I mount * tasks: intended to run a cron daemon to run arbitrary periodic tasks. I mount

59
pleroma/Dockerfile Normal file
View File

@ -0,0 +1,59 @@
FROM elixir:1.11.3-alpine as build
ENV MIX_ENV=prod
RUN apk add \
git \
gcc \
g++ \
musl-dev \
make \
cmake \
file-dev && \
git clone \
-b develop \
https://git.pleroma.social/pleroma/pleroma.git \
/pleroma && \
echo "import Mix.Config" > /pleroma/config/prod.secret.exs && \
cd /pleroma && \
mix local.hex --force && \
mix local.rebar --force && \
mix deps.get --only prod && \
mkdir -p /pleroma/release && \
mix release --path release
FROM alpine:3.13
RUN apk add --update --no-cache \
exiftool \
imagemagick \
libmagic \
ncurses \
postgresql-client && \
addgroup \
--gid 10001 \
pleroma && \
adduser \
--system \
--shell /bin/false \
--home /opt/pleroma \
--uid 10000 \
--ingroup pleroma \
pleroma && \
mkdir -p /var/lib/pleroma/uploads && \
mkdir -p /var/lib/pleroma/static && \
chown -R pleroma /var/lib/pleroma && \
mkdir -p /etc/pleroma && \
chown -R pleroma /etc/pleroma
ENV PATH=/opt/pleroma/bin:$PATH
COPY entrypoint.sh /usr/local/bin/entrypoint
RUN chmod +x /usr/local/bin/entrypoint
USER pleroma
COPY --from=build --chown=pleroma:0 /pleroma/release /opt/pleroma
ENTRYPOINT ["/usr/local/bin/entrypoint"]
CMD ["/opt/pleroma/bin/pleroma", "start"]

10
pleroma/Makefile Normal file
View File

@ -0,0 +1,10 @@
USERNAME = rilla
IMG_NAME = pleroma
.PHONY: build build-nc
build: Dockerfile entrypoint.sh
docker build -t $(USERNAME)/$(IMG_NAME) .
build-nc: Dockerfile entrypoint.sh
docker build --no-cache -t $(USERNAME)/$(IMG_NAME) .

18
pleroma/entrypoint.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/ash
set -e
DB_USER="${DB_USER:-pleroma}"
DB_HOST="${DB_HOST:-db}"
DB_NAME="${DB_NAME:-pleroma}"
echo "-- Waiting for database..."
while ! pg_isready -U "${DB_USER}" -d "postgres://${DB_HOST}:5432/${DB_NAME}" -t 1; do
sleep 1s
done
echo "-- Running migrations..."
/opt/pleroma/bin/pleroma_ctl migrate
echo "-- Starting!"
exec "$@"