From ddb0c180d906c755f7172f13fdce18c931719e2a Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Fri, 16 Sep 2022 12:12:02 +0200 Subject: [PATCH] rsyncd: secrets file is set up by entrypoint script --- rsyncd/Dockerfile | 8 ++++++-- rsyncd/Makefile | 4 ++-- rsyncd/entrypoint.sh | 8 ++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 rsyncd/entrypoint.sh diff --git a/rsyncd/Dockerfile b/rsyncd/Dockerfile index bd9ef73..7c2abac 100644 --- a/rsyncd/Dockerfile +++ b/rsyncd/Dockerfile @@ -1,5 +1,9 @@ FROM alpine:3.16 -RUN apk add --no-cache rsync +COPY entrypoint.sh /entrypoint.sh -CMD ["/usr/bin/rsync", "--daemon", "--no-detach", "--config", "/etc/rsyncd.conf"] +RUN chmod +x /entrypoint.sh && \ + apk add --no-cache rsync + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["/usr/bin/rsync", "--daemon", "--no-detach", "--config", "/etc/rsyncd.conf", "--verbose"] diff --git a/rsyncd/Makefile b/rsyncd/Makefile index 3419c97..922119d 100644 --- a/rsyncd/Makefile +++ b/rsyncd/Makefile @@ -5,13 +5,13 @@ PLATFORMS=linux/amd64,linux/arm64 .PHONY: build push buildx -build: Dockerfile +build: Dockerfile entrypoint.sh docker build -t $(IMG) . push: build docker image push $(IMG) -buildx: Dockerfile +buildx: Dockerfile entrypoint.sh docker buildx build \ --platform $(PLATFORMS) \ --tag $(IMG) \ diff --git a/rsyncd/entrypoint.sh b/rsyncd/entrypoint.sh new file mode 100644 index 0000000..fc15f07 --- /dev/null +++ b/rsyncd/entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ -n "$SECRETS" ]; then + echo "$SECRETS" > /etc/rsyncd.secrets + chmod 600 /etc/rsyncd.secrets +fi + +exec "$@"