Add docker files

This commit is contained in:
clunietp 2019-12-27 06:57:42 -05:00
parent da072ddcf9
commit ba597fd89e
2 changed files with 67 additions and 0 deletions

41
Dockerfile Normal file
View File

@ -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

26
docker-compose.yml Normal file
View File

@ -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