Skip to content

Instantly share code, notes, and snippets.

@Neirth
Created May 17, 2023 23:43
Show Gist options
  • Select an option

  • Save Neirth/6d2fd5c5a63e7420ed927c0b7aea0ef2 to your computer and use it in GitHub Desktop.

Select an option

Save Neirth/6d2fd5c5a63e7420ed927c0b7aea0ef2 to your computer and use it in GitHub Desktop.
Docker Service to Bind rclone Storage to S3 compatible API
FROM alpine:edge
# Install the rest of dependencies inside minio image
RUN apk add minio supervisor rclone fuse3
# Prepare data temp folder
RUN mkdir -p /data/backup
# Configure rclone remote path
ENV REMOTE_PATH
# Configure supervisord for interact with minio and rclone
RUN echo -e ' \n\
[supervisord] \n\
nodaemon=true \n\
user=root \n\
loglevel=info \n\
\n\
[program:minio] \n\
command=/bin/sh -c "sleep 5 && minio server /data --console-address 0.0.0.0:9001" \n\
stdout_logfile=/dev/stdout \n\
stdout_logfile_maxbytes=0 \n\
stderr_logfile=/dev/stderr \n\
stderr_logfile_maxbytes=0 \n\
\n\
[program:rclone] \n\
command=/bin/sh -c "/usr/bin/rclone --config=/etc/rclone.conf mount $REMOTE_PATH /data/ --vfs-cache-mode writes --cache-dir /tmp --allow-non-empty" \n\
stdout_logfile=/dev/stdout \n\
stdout_logfile_maxbytes=0 \n\
stderr_logfile=/dev/stderr \n\
stderr_logfile_maxbytes=0 \n\
' >> /etc/supervisord.conf
# Expose minio ports
EXPOSE 9000
EXPOSE 9001
# Configure exposable rclone config
VOLUME ["/etc/rclone/config"]
# Set the entrypoint for supervisord
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment