mirror of
https://github.com/Fishwaldo/docker-rsync.git
synced 2025-03-15 19:42:44 +00:00
feat: add Dockerfile
This commit is contained in:
parent
dfad5ec32f
commit
647a53b5ae
2 changed files with 37 additions and 0 deletions
14
Dockerfile
Normal file
14
Dockerfile
Normal 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
23
rsync
Normal 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 "$@"
|
Loading…
Add table
Reference in a new issue