From ba597fd89e6f25268f6cf0ee2e7babf3119676a5 Mon Sep 17 00:00:00 2001 From: clunietp Date: Fri, 27 Dec 2019 06:57:42 -0500 Subject: [PATCH] Add docker files --- Dockerfile | 41 +++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..249f65a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,41 @@ + +FROM alpine:edge + +ENV MEGA_VERSION=v3.6.5 +ENV TRICKLE_VERSION=596bb13f2bc323fc8e7783b8dcba627de4969e07 +ENV TRICKLE_SHA256SUM=a4111063d67a3330025eea2f29ebd8c8605e43cc1be0bf384b48f0eab8daf508 + +RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories + +# trickle +# work around issue #16: https://github.com/mariusae/trickle/issues/16 +RUN set -eux; \ + apk add --no-cache libcurl libtirpc-dev libevent \ + && apk add --no-cache --virtual .build-deps curl make automake autoconf libtool alpine-sdk libevent-dev; \ + cd /tmp; \ + curl -L -o trickle.tgz https://github.com/mariusae/trickle/archive/${TRICKLE_VERSION}.tar.gz; \ + echo "$TRICKLE_SHA256SUM trickle.tgz" | sha256sum -c -; \ + tar xvzf trickle.tgz; \ + cd "trickle-${TRICKLE_VERSION}"; \ + export CFLAGS=-I/usr/include/tirpc; \ + export LDFLAGS=-ltirpc; \ + autoreconf -if; \ + ./configure; \ + make install-exec-am install-trickleoverloadDATA; \ + rm -rf /tmp/*; \ + apk del .build-deps; + +# megasync: https://gist.github.com/MaxKh/ae9ce059899f34ed2bd09e6995a91a08 +RUN apk add --no-cache libcurl c-ares crypto++ zlib openssl sqlite-libs readline libsodium libtirpc-dev libevent-dev \ + && apk add --no-cache --virtual .build-deps \ + curl file git make automake autoconf libtool gcc libc-dev g++ curl-dev c-ares-dev crypto++-dev zlib-dev openssl-dev sqlite-dev readline-dev libsodium-dev \ + && git clone -b ${MEGA_VERSION} --depth 1 https://github.com/meganz/sdk.git \ + && cd sdk \ + && ./autogen.sh \ + && CXXFLAGS="-O2 -Wno-deprecated-declarations -Wno-psabi --param ggc-min-expand=1" ./configure --without-freeimage \ + && make examples/megacli \ + && make examples/megasimplesync \ + && make install \ + && cd ../ \ + && rm -rf sdk \ + && apk del .build-deps diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f9f3f50 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3.4' + +services: + megasync_trickle: + build: + context: . + dockerfile: Dockerfile + image: megasync_trickle + container_name: megasync_trickle + tmpfs: + - /tmp + restart: unless-stopped + volumes: + # map your local sync dir to /mnt/megasync + - /path/to/your/local/dir:/mnt/megasync + entrypoint: /bin/sh + # change trickle parameters here (or remove trickle entirely) + # -d RATE: Limit the download bandwidth consumption to RATE KB/s + # -u RATE: Limit the upload bandwidth consumption to RATE KB/s + # see other parameters at https://linux.die.net/man/1/trickle + # megasimplesync localdir remotedir + command: -c "trickle -s -d 1024 -u 1024 megasimplesync /mnt/megasync /" + environment: + - MEGA_DEBUG=0 # set to 1 or 2 to see mega debugging output + - MEGA_EMAIL=user@domain.com # your mega username + - MEGA_PWD=your_mega_password # your mega password