feat: add Dockerfile

This commit is contained in:
David Stefan 2017-04-30 10:20:17 +01:00
parent dfad5ec32f
commit 647a53b5ae
2 changed files with 37 additions and 0 deletions

14
Dockerfile Normal file
View file

@ -0,0 +1,14 @@
FROM debian:jessie
MAINTAINER DAVID Stefan <stefda@gmail.com>
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends rsync && \
apt-get clean autoclean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
EXPOSE 873
VOLUME /docker
ADD ./rsync /usr/local/bin/rsync
ENTRYPOINT ["/usr/local/bin/rsync"]

23
rsync Normal file
View file

@ -0,0 +1,23 @@
#!/bin/bash
VOLUME=${VOLUME:-/docker}
ALLOW=${ALLOW:-192.168.0.0/16 172.16.0.0/12}
OWNER=${OWNER:-nobody}
GROUP=${GROUP:-nogroup}
chown "${OWNER}:${GROUP}" "${VOLUME}"
[ -f /etc/rsyncd.conf ] || cat <<EOF > /etc/rsyncd.conf
uid = ${OWNER}
gid = ${GROUP}
use chroot = yes
log file = /dev/stdout
reverse lookup = no
[volume]
hosts deny = *
hosts allow = ${ALLOW}
read only = false
path = ${VOLUME}
comment = docker volume
EOF
exec /usr/bin/rsync --no-detach --daemon --config /etc/rsyncd.conf "$@"