diff options
author | 2020-04-23 16:33:39 -0700 | |
---|---|---|
committer | 2020-04-23 16:33:39 -0700 | |
commit | e91c97ff20233d2e0048e462ad25be22d2123edb (patch) | |
tree | 33f1f284c9ea45384bb2cf477925a12c2a97d30c /Dockerfile | |
download | rsync-service-e91c97ff20233d2e0048e462ad25be22d2123edb.tar.gz rsync-service-e91c97ff20233d2e0048e462ad25be22d2123edb.tar.bz2 rsync-service-e91c97ff20233d2e0048e462ad25be22d2123edb.zip |
Add a docker container for rsync.
This is cribbed off of my old work at
https://gitweb.gentoo.org/dev/antarus.git/tree/src/infra.gentoo.org/rsync-node.
Basically its a stage3 that serves rsync atomically. It needs some tests
and some CI.
Signed-off-by: Alec Warner <antarus@gentoo.org>
Diffstat (limited to 'Dockerfile')
-rw-r--r-- | Dockerfile | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..73a69da --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +# Base Image +FROM gentoo/stage3-amd64-hardened:latest AS base +WORKDIR / + +COPY wrap_rsync.sh /opt/rsync/wrap_rsync.sh +COPY ./rsync-mirror /etc/xinetd.d/rsync-mirror + +# Normally I would advocate for ARG here and pass arguments to wrap_rsync. +# This would enable new docker builds with arguments like: +# docker build . --build_arg WAIT_TIME=30m -t gentoo/rsync +# However, ARG's cannot be passed to ENTRYPOINTs, so we set these as ENV instead. + +# Mirror to get data from. +ENV SOURCE_MIRROR=rsync://turnstone.gentoo.org./gentoo-portage +# ENV SOURCE_MIRROR=rsync://rsync.us.gentoo.org/gentoo-portage + +# Possibly a stateful volume +ENV DEST_DIR=/srv/gentoo +# A memory-backed volume +ENV TMP_DIR=/srv/ephemeral + +# How long to wait between syncs; must be a valid argument to sleep +ENV WAIT_TIME=30m + +# Create TMP_DIR and DEST_DIR +WORKDIR $TMP_DIR +WORKDIR $DEST_DIR + +# Expose Rsync port +EXPOSE 873 + +# Stop xinetd; wrap_rsync will start it when the container is started. +CMD /etc/init.d/xinetd stop + +# Execute wrapper. +ENTRYPOINT /opt/rsync/wrap_rsync.sh |