From 1baba1d841a2e27c3449606e72d67c5af2a2e74c Mon Sep 17 00:00:00 2001 From: Marcus Noble Date: Sun, 7 Jun 2020 12:50:01 +0100 Subject: [PATCH] Initial release --- Dockerfile | 17 +++++++++++++++++ Makefile | 22 +--------------------- README.md | 15 ++++++++++++--- entrypoint.sh | 4 ++++ 4 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index e69de29..6385f1f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM ubuntu:19.10 + +RUN apt-get update && apt-get install -y curl +RUN curl -o megacmd-xUbuntu_19.10_amd64.deb https://mega.nz/linux/MEGAsync/xUbuntu_19.10/amd64/megacmd-xUbuntu_19.10_amd64.deb +RUN apt install -y ./megacmd-xUbuntu_19.10_amd64.deb + +ADD entrypoint.sh / + +RUN adduser --disabled-password --gecos '' mega && adduser mega sudo && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +USER mega + +WORKDIR /home/mega + +ENV PASSWORD= +ENV EMAIL= + +CMD /entrypoint.sh diff --git a/Makefile b/Makefile index b486156..7010890 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .DEFAULT_GOAL := default -IMAGE ?= docker.cloud.cluster.fun/private/REPO_NAME_LOWER:latest +IMAGE ?= docker.cluster.fun/averagemarcus/megasync:latest .PHONY: test # Run all tests, linting and format checks test: lint check-format run-tests @@ -8,42 +8,26 @@ test: lint check-format run-tests .PHONY: lint # Perform lint checks against code lint: @echo "⚠️ 'lint' unimplemented" - # GO Projects - # @go vet && golint -set_exit_status ./... .PHONY: check-format # Checks code formatting and returns a non-zero exit code if formatting errors found check-format: @echo "⚠️ 'check-format' unimplemented" - # GO Projects - # @gofmt -e -l . .PHONY: format # Performs automatic format fixes on all code format: @echo "⚠️ 'format' unimplemented" - # GO Projects - # @gofmt -s -w . .PHONY: run-tests # Runs all tests run-tests: @echo "⚠️ 'run-tests' unimplemented" - # GO Projects - # @go test - # Node Projects - # @npm test .PHONY: fetch-deps # Fetch all project dependencies fetch-deps: @echo "⚠️ 'fetch-deps' unimplemented" - # GO Projects - # @go mod tidy - # Node Projects - # @npm install .PHONY: build # Build the project build: lint check-format fetch-deps @echo "⚠️ 'build' unimplemented" - # GO Projects - # @go build -o PROJECT_NAME main.go .PHONY: docker-build # Build the docker image docker-build: @@ -56,10 +40,6 @@ docker-publish: .PHONY: run # Run the application run: @echo "⚠️ 'run' unimplemented" - # GO Projects - # @go run main.go - # Node Projects - # @npm start .PHONY: ci # Perform CI specific tasks to perform on a pull request ci: diff --git a/README.md b/README.md index 187dfcd..a69b8e3 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,20 @@ # megasync -Run mega-sync as a Docker image +Run [mega-sync](https://mega.nz/sync) as a Docker image ## Features -## Install +* Keeps your MEGASync directory in your Mega account in sync with the `/home/mega` directory in the container -```sh +## Usage ``` +docker run -d \ + -e EMAIL=YOUR_MEGA_ACCOUNT_EMAIL \ + -e PASSWORD=YOUR_MEGA_PASSWORD \ + -v /path/to/sync:/home/mega \ + docker.cluster.fun/averagemarcus/megasync +``` ## Building from source @@ -26,6 +32,9 @@ make build ## Resources +* [mega-sync](https://mega.nz/sync) +* [MEGAcmd](https://github.com/meganz/MEGAcmd) + ## Contributing If you find a bug or have an idea for a new feature please [raise an issue](/AverageMarcus/megasync/issues/new) to discuss it. diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..7063555 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/bash +mega-login ${EMAIL} ${PASSWORD} +mega-sync ./ /MEGAsync +cat