Skip to content

Commit daa5891

Browse files
committed
rsync
1 parent b3445b6 commit daa5891

3 files changed

Lines changed: 40 additions & 0 deletions

File tree

.github/workflows/docker-build.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
paths:
1212
- 'runner/**'
1313
- 'btc/**'
14+
- 'rsync/**'
1415
schedule:
1516
- cron: '0 6 * * 1' # Every Monday at 06:00 UTC
1617

rsync/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM ubuntu:24.04
2+
RUN apt-get update && \
3+
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends rsync && \
4+
apt-get clean autoclean && \
5+
apt-get autoremove -y && \
6+
rm -rf /var/lib/apt/lists/*
7+
8+
EXPOSE 873
9+
ADD ./entrypoint.sh /entrypoint.sh
10+
RUN chmod +x /entrypoint.sh
11+
12+
ENTRYPOINT ["/entrypoint.sh"]

rsync/entrypoint.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
VOLUME=${VOLUME:-/volume}
3+
ALLOW=${ALLOW:-192.168.0.0/16 172.16.0.0/12}
4+
USER=${USER:-nobody}
5+
GROUP=${GROUP:-nogroup}
6+
7+
mkdir -p ${VOLUME}
8+
9+
getent group ${GROUP} > /dev/null || addgroup ${GROUP}
10+
getent passwd ${USER} > /dev/null || adduser -D -H -G ${GROUP} ${USER}
11+
chown -R ${USER}:${GROUP} ${VOLUME}
12+
13+
cat <<EOF > /etc/rsyncd.conf
14+
uid = ${USER}
15+
gid = ${GROUP}
16+
use chroot = yes
17+
log file = /dev/stdout
18+
reverse lookup = no
19+
[volume]
20+
hosts deny = *
21+
hosts allow = ${ALLOW}
22+
read only = false
23+
path = ${VOLUME}
24+
comment = docker volume
25+
EOF
26+
27+
exec /usr/bin/rsync --no-detach --daemon --config /etc/rsyncd.conf

0 commit comments

Comments
 (0)