Merge branch 'master' of ssh://192.168.1.191/dockerfiles

main
Ricard Illa 2021-04-13 15:38:28 +02:00
commit 9a8833fd36
6 changed files with 112 additions and 2 deletions

View File

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

View File

@ -28,6 +28,7 @@ useful.
* gitolite-pystagit: well, gitolite + pystagit
* 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
* nfs-server
* pleroma
* sassc
* syncthing

15
nfs-server/Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM alpine:3.13
COPY entrypoint.sh /usr/local/bin/entrypoint
RUN apk add --no-cache nfs-utils && \
rm /etc/idmapd.conf /etc/exports && \
mkdir -p /var/lib/nfs/rpc_pipefs /var/lib/nfs/v4recovery && \
echo "rpc_pipefs /var/lib/nfs/rpc_pipefs rpc_pipefs defaults 0 0" >> /etc/fstab && \
echo "nfsd /proc/fs/nfsd nfsd defaults 0 0" >> /etc/fstab && \
chmod +x /usr/local/bin/entrypoint
EXPOSE 2049
ENTRYPOINT ["/usr/local/bin/entrypoint"]

10
nfs-server/Makefile Normal file
View File

@ -0,0 +1,10 @@
USERNAME = rilla
IMG_NAME = nfs-server
.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) .

72
nfs-server/entrypoint.sh Normal file
View File

@ -0,0 +1,72 @@
#!/bin/sh
NTHREADS=${NTHREADS:=1}
stop () {
echo "un-exporting filesystems"
/usr/sbin/exportfs -uav
echo "terminating nfsd"
/usr/sbin/rpc.nfsd 0
echo "killing pids"
pid1=$(pidof rpc.nfsd)
pid2=$(pidof rpc.mountd)
pid3=$(pidof rpc.rpcbind)
kill -TERM "$pid1" "$pid2" "$pid3"
echo "un-mounting /var/lib/nfs/rpc_pipefs"
umount /var/lib/nfs/rpc_pipefs
echo "un-mounting /proc/nfs/nfsd"
umount /proc/fs/nfsd
exit 0
}
boot () {
echo "mounting /var/lib/nfs/rpc_pipefs"
/bin/mount -t rpc_pipefs /var/lib/nfs/rpc_pipefs
echo "mounting /proc/fs/nfsd"
/bin/mount -t nfsd /proc/fs/nfsd
echo "starting rpcbind"
/sbin/rpcbind -sw
/sbin/rpcinfo
echo "exporting filesystems"
/usr/sbin/exportfs -ar
cat /etc/exports
echo "starting mountd"
/usr/sbin/rpc.mountd \
--port 32767 \
--nfs-version 4 \
--no-nfs-version 2 \
--no-nfs-version 3
echo "starting nfsd"
/usr/sbin/rpc.nfsd \
--tcp \
--udp \
--port 2049 \
--nfs-version 4 \
--no-nfs-version 2 \
--no-nfs-version 3 \
"${NTHREADS}"
echo "terminating rpcbind"
pid=$(pidof rpcbind)
[ -n "$pid" ] && kill "$pid"
echo "ready"
}
trap stop TERM INT
boot
while :; do
sleep 2073600 &
wait
done

View File

@ -33,9 +33,17 @@ RUN addgroup \
--ingroup transmission \
--disabled-password \
--shell /sbin/nologin \
transmission
transmission && \
mkdir -p \
/var/lib/transmission/blocklists \
/var/lib/transmission/downloads \
/var/lib/transmission/incomplete \
/var/lib/transmission/resume \
/var/lib/transmission/torrents && \
chown -R transmission:transmission /var/lib/transmission
ENV TRANSMISSION_HOME /var/lib/transmission
USER transmission
WORKDIR /var/lib/transmission
CMD ["/usr/local/bin/transmission-daemon", "--foreground"]