From 35f024815abc9bbcfeb692d9d0f777d58913044f Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Tue, 13 Apr 2021 15:36:59 +0200 Subject: [PATCH] dendrite --- Makefile | 5 ++++- README.md | 1 + dendrite/Dockerfile | 33 +++++++++++++++++++++++++++++++++ dendrite/Makefile | 10 ++++++++++ dendrite/entrypoint.sh | 4 ++++ 5 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 dendrite/Dockerfile create mode 100644 dendrite/Makefile create mode 100644 dendrite/entrypoint.sh diff --git a/Makefile b/Makefile index 77ef4ca..fe5ea5a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -images=agate archivebox ansible backup buku ddclient git-daemon gitolite gitolite-pystagit rss-bridge pleroma sassc syncthing tasks tor transmission vdirsyncer xandikos +images=agate archivebox ansible backup buku ddclient git-daemon gitolite gitolite-pystagit rss-bridge pleroma sassc syncthing tasks tor transmission vdirsyncer xandikos dendrite .PHONY: all $(images) all: $(images) @@ -57,3 +57,6 @@ vdirsyncer: xandikos: $(BUILD) + +dendrite: + $(BUILD) diff --git a/README.md b/README.md index 0c1ebac..ecebc8b 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ useful. * backup: simple image used in some of my backup daemons * buku: buku and bukuserver * ddclient +* dendrite * git-daemon: for git-daemon and git-http-backend * gitolite-pystagit: well, gitolite + pystagit * gitolite: gitolite + docker, so that I can mount the docker socket inside of diff --git a/dendrite/Dockerfile b/dendrite/Dockerfile new file mode 100644 index 0000000..6df15a5 --- /dev/null +++ b/dendrite/Dockerfile @@ -0,0 +1,33 @@ +FROM golang:1.16.3-alpine3.13 AS builder + +RUN apk --no-cache add git build-base && \ + mkdir -p /build && \ + git clone https://github.com/matrix-org/dendrite /build/dendrite && \ + mkdir -p /build/bin && \ + cd /build/dendrite && \ + go build -trimpath -o /build/bin/ ./cmd/dendrite-monolith-server && \ + go build -trimpath -o /build/bin/ ./cmd/goose && \ + go build -trimpath -o /build/bin/ ./cmd/create-account && \ + go build -trimpath -o /build/bin/ ./cmd/generate-keys + +FROM alpine:3.13 + +COPY --from=builder /build/bin/* /usr/local/bin +COPY entrypoint.sh /usr/local/bin/entrypoint + +RUN chmod +x /usr/local/bin/entrypoint && \ + addgroup --gid 10001 dendrite && \ + adduser \ + --uid 10000 \ + --home /var/lib/dendrite \ + --ingroup dendrite \ + --disabled-password \ + --shell /sbin/nologin \ + dendrite && \ + mkdir -p /var/log/dendrite && \ + chown -R dendrite:dendrite /var/log/dendrite + +WORKDIR /etc/dendrite +USER dendrite + +ENTRYPOINT ["/usr/local/bin/entrypoint"] diff --git a/dendrite/Makefile b/dendrite/Makefile new file mode 100644 index 0000000..f274304 --- /dev/null +++ b/dendrite/Makefile @@ -0,0 +1,10 @@ +USERNAME = rilla +IMG_NAME = dendrite + +.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) . diff --git a/dendrite/entrypoint.sh b/dendrite/entrypoint.sh new file mode 100644 index 0000000..ed15498 --- /dev/null +++ b/dendrite/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +sleep 5 +exec /usr/local/bin/dendrite-monolith-server -config /etc/dendrite/dendrite.yaml "$@"