From 76803dc3d10b14d3f0a8715746f2e31ef27487ac Mon Sep 17 00:00:00 2001 From: Cauly Date: Tue, 22 Jan 2019 09:31:57 +0800 Subject: [PATCH 01/12] add detailed instructions for docker README.md --- docker/README.md | 88 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 65 insertions(+), 23 deletions(-) diff --git a/docker/README.md b/docker/README.md index 1a03f287..c34ea011 100644 --- a/docker/README.md +++ b/docker/README.md @@ -5,12 +5,74 @@ Thats right folks onedrive is now dockerized ;) This container offers simple monitoring-mode service for 'Free Client for OneDrive on Linux'. ## Usage instructions + +0. Install the docker under your own platform's instructions + +1. Pull the image + ```bash docker pull driveone/onedrive ``` **NOTE:** SELinux context needs to be configured or disabled for Docker, to be able to write to OneDrive host directory. -1. Run or update onedrive container +2. Prepare required stuff + +Onedrive needs two volumns. One is config volumn, which is recommanded to be a docker volumn. You can create it with: +```bash +docker volume create onedrive_conf; +``` + +This will create a docker volumn labeled 'onedrive_conf', which we will use it later. + +The second one is your data folder that needs to sync with. The owner of the folder must not be root, and you must have permission to its parent directory (because onedrive will try to setup a monitor for the sync folder). + +3. First run + +Onedrive also needs to be authurized with your account. This is done by running docker in interactive mode. + +**make sure to change onedriveDir to your own.** +```bash +onedriveDir="${HOME}/OneDrive" +docker run -it --restart unless-stopped --name onedrive -v onedrive_conf:/onedrive/conf -v "${onedriveDir}:/onedrive/data" driveone/onedrive +``` + +You will be asked to open a specific link using your web browser where you will have to login into your Microsoft Account and give the application the permission to access your files. After giving the permission, you will be redirected to a blank page. Copy the URI of the blank page into the application. + +If your onedrive is working as expected, you can detach from the container with Ctrl+p, Ctrl+q. + +4. Status, stop, and restart, etc. + +Check if monitor service is running +```bash +docker ps -f name=onedrive +``` + +Show monitor run logs +```bash +docker logs onedrive +``` + +Stop running monitor +```bash +docker stop onedrive +``` + +Resume monitor +```bash +docker start onedrive +``` + +Unregister onedrive monitor +```bash +docker rm -f onedrive +``` + +5. Eidt the config + +Onedrive should run in default configuration, but however you can change your configuration. First download the default config from [https://raw.githubusercontent.com/abraunegg/onedrive/master/config] and put it into your onedrive_conf volumn. The detailed document can be found here: [https://github.com/abraunegg/onedrive#additional-configuration] + +## Run or update with one script +If you are experienced with docker and onedrive, you can use the following script: ```bash # Update onedriveDir with correct existing OneDrive directory path onedriveDir="${HOME}/OneDrive" @@ -21,30 +83,10 @@ docker inspect onedrive_conf > /dev/null || { docker volume create onedrive_conf docker inspect onedrive > /dev/null && docker rm -f onedrive docker run $firstRun --restart unless-stopped --name onedrive -v onedrive_conf:/onedrive/conf -v "${onedriveDir}:/onedrive/data" driveone/onedrive ``` -## Poweruser section -1. Check if monitor service is running -```bash -docker ps -f name=onedrive -``` -2. Show monitor run logs -```bash -docker logs onedrive -``` -3. Stop running monitor -```bash -docker stop onedrive -``` -4. Resume monitor -```bash -docker start onedrive -``` -5. Unregister onedrive monitor -```bash -docker rm -f onedrive -``` + ## Build instructions ```bash -cd docker git clone https://github.com/abraunegg/onedrive +cd onedrive/docker docker build . -t driveone/onedrive ``` From 5372d8a9fa70c338d041851d30ab0b0ef6bd5efe Mon Sep 17 00:00:00 2001 From: Cauly Date: Tue, 22 Jan 2019 09:34:44 +0800 Subject: [PATCH 02/12] add detailed instructions for docker README.md --- docker/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/README.md b/docker/README.md index c34ea011..f55eda7a 100644 --- a/docker/README.md +++ b/docker/README.md @@ -6,16 +6,16 @@ This container offers simple monitoring-mode service for 'Free Client for OneDri ## Usage instructions -0. Install the docker under your own platform's instructions +### 0. Install the docker under your own platform's instructions -1. Pull the image +### 1. Pull the image ```bash docker pull driveone/onedrive ``` **NOTE:** SELinux context needs to be configured or disabled for Docker, to be able to write to OneDrive host directory. -2. Prepare required stuff +### 2. Prepare required stuff Onedrive needs two volumns. One is config volumn, which is recommanded to be a docker volumn. You can create it with: ```bash @@ -26,7 +26,7 @@ This will create a docker volumn labeled 'onedrive_conf', which we will use it l The second one is your data folder that needs to sync with. The owner of the folder must not be root, and you must have permission to its parent directory (because onedrive will try to setup a monitor for the sync folder). -3. First run +### 3. First run Onedrive also needs to be authurized with your account. This is done by running docker in interactive mode. @@ -40,7 +40,7 @@ You will be asked to open a specific link using your web browser where you will If your onedrive is working as expected, you can detach from the container with Ctrl+p, Ctrl+q. -4. Status, stop, and restart, etc. +### 4. Status, stop, and restart, etc. Check if monitor service is running ```bash @@ -67,7 +67,7 @@ Unregister onedrive monitor docker rm -f onedrive ``` -5. Eidt the config +### 5. Eidt the config Onedrive should run in default configuration, but however you can change your configuration. First download the default config from [https://raw.githubusercontent.com/abraunegg/onedrive/master/config] and put it into your onedrive_conf volumn. The detailed document can be found here: [https://github.com/abraunegg/onedrive#additional-configuration] From af2ee9e5401793bae0133402bee9a195ede33830 Mon Sep 17 00:00:00 2001 From: Cauly Date: Tue, 22 Jan 2019 11:40:19 +0800 Subject: [PATCH 03/12] typo fixes --- docker/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/README.md b/docker/README.md index f55eda7a..b4bac131 100644 --- a/docker/README.md +++ b/docker/README.md @@ -17,18 +17,18 @@ docker pull driveone/onedrive ### 2. Prepare required stuff -Onedrive needs two volumns. One is config volumn, which is recommanded to be a docker volumn. You can create it with: +Onedrive needs two volumes. One is config volume, which is recommanded to be a docker volume. You can create it with: ```bash docker volume create onedrive_conf; ``` -This will create a docker volumn labeled 'onedrive_conf', which we will use it later. +This will create a docker volume labeled 'onedrive_conf', which we will use it later. The second one is your data folder that needs to sync with. The owner of the folder must not be root, and you must have permission to its parent directory (because onedrive will try to setup a monitor for the sync folder). ### 3. First run -Onedrive also needs to be authurized with your account. This is done by running docker in interactive mode. +Onedrive also needs to be authorized with your account. This is done by running docker in interactive mode. **make sure to change onedriveDir to your own.** ```bash @@ -40,7 +40,7 @@ You will be asked to open a specific link using your web browser where you will If your onedrive is working as expected, you can detach from the container with Ctrl+p, Ctrl+q. -### 4. Status, stop, and restart, etc. +### 4. Status, stop, and restart Check if monitor service is running ```bash @@ -67,9 +67,9 @@ Unregister onedrive monitor docker rm -f onedrive ``` -### 5. Eidt the config +### 5. Edit the config -Onedrive should run in default configuration, but however you can change your configuration. First download the default config from [https://raw.githubusercontent.com/abraunegg/onedrive/master/config] and put it into your onedrive_conf volumn. The detailed document can be found here: [https://github.com/abraunegg/onedrive#additional-configuration] +Onedrive should run in default configuration, but however you can change your configuration. First download the default config from [here](https://raw.githubusercontent.com/abraunegg/onedrive/master/config) and put it into your onedrive_conf volumn. The detailed document can be found here: [additional-configuration](https://github.com/abraunegg/onedrive#additional-configuration) ## Run or update with one script If you are experienced with docker and onedrive, you can use the following script: From 14c36d6c910caec04569a7f5a6b3fee469574277 Mon Sep 17 00:00:00 2001 From: Cauly Date: Tue, 22 Jan 2019 16:37:47 +0800 Subject: [PATCH 04/12] format long lines and fix build script --- docker/README.md | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/docker/README.md b/docker/README.md index b4bac131..6a0b2d64 100644 --- a/docker/README.md +++ b/docker/README.md @@ -17,18 +17,25 @@ docker pull driveone/onedrive ### 2. Prepare required stuff -Onedrive needs two volumes. One is config volume, which is recommanded to be a docker volume. You can create it with: +Onedrive needs two volumes. One of them is the config volume. + +If you dont't need an extra config file, You can create a docker volume: ```bash docker volume create onedrive_conf; ``` This will create a docker volume labeled 'onedrive_conf', which we will use it later. -The second one is your data folder that needs to sync with. The owner of the folder must not be root, and you must have permission to its parent directory (because onedrive will try to setup a monitor for the sync folder). +The second one is your data folder that needs to sync with. Keep in mind that: + +- The owner of the folder must not be root +- The owner have permission to its parent directory + (because onedrive will try to setup a monitor for the sync folder). ### 3. First run -Onedrive also needs to be authorized with your account. This is done by running docker in interactive mode. +Onedrive also needs to be authorized with your account. +This is done by running docker in interactive mode. **make sure to change onedriveDir to your own.** ```bash @@ -36,7 +43,10 @@ onedriveDir="${HOME}/OneDrive" docker run -it --restart unless-stopped --name onedrive -v onedrive_conf:/onedrive/conf -v "${onedriveDir}:/onedrive/data" driveone/onedrive ``` -You will be asked to open a specific link using your web browser where you will have to login into your Microsoft Account and give the application the permission to access your files. After giving the permission, you will be redirected to a blank page. Copy the URI of the blank page into the application. +- You will be asked to open a specific link using your web browser +- login into your Microsoft Account and give the application the permission +- After giving the permission, you will be redirected to a blank page. +- Copy the URI of the blank page into the application. If your onedrive is working as expected, you can detach from the container with Ctrl+p, Ctrl+q. @@ -69,7 +79,14 @@ docker rm -f onedrive ### 5. Edit the config -Onedrive should run in default configuration, but however you can change your configuration. First download the default config from [here](https://raw.githubusercontent.com/abraunegg/onedrive/master/config) and put it into your onedrive_conf volumn. The detailed document can be found here: [additional-configuration](https://github.com/abraunegg/onedrive#additional-configuration) +Onedrive should run in default configuration, but however you can change your configuration. + +First download the default config from [here](https://raw.githubusercontent.com/abraunegg/onedrive/master/config) +Then put it into your onedrive_conf volume: `/var/lib/docker/volumes/onedrive_conf/_data` + +Or you can map your own config folder to config volume (copy stuffs from docker volume first) + +The detailed document for the config can be found here: [additional-configuration](https://github.com/abraunegg/onedrive#additional-configuration) ## Run or update with one script If you are experienced with docker and onedrive, you can use the following script: @@ -87,6 +104,6 @@ docker run $firstRun --restart unless-stopped --name onedrive -v onedrive_conf:/ ## Build instructions ```bash git clone https://github.com/abraunegg/onedrive -cd onedrive/docker -docker build . -t driveone/onedrive +cd onedrive +docker build . -f docker/Dockerfile -t driveone/onedrive ``` From 11724323902a4ab8496475ad394f94a308bacf03 Mon Sep 17 00:00:00 2001 From: Cauly Kan Date: Wed, 23 Jan 2019 09:20:52 +0800 Subject: [PATCH 05/12] fix format issues in docker/readme.md --- docker/README.md | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/docker/README.md b/docker/README.md index 6a0b2d64..26cdd4a4 100644 --- a/docker/README.md +++ b/docker/README.md @@ -6,13 +6,14 @@ This container offers simple monitoring-mode service for 'Free Client for OneDri ## Usage instructions -### 0. Install the docker under your own platform's instructions +### 0. Install the docker under your own platform's instructions ### 1. Pull the image ```bash docker pull driveone/onedrive ``` + **NOTE:** SELinux context needs to be configured or disabled for Docker, to be able to write to OneDrive host directory. ### 2. Prepare required stuff @@ -20,6 +21,7 @@ docker pull driveone/onedrive Onedrive needs two volumes. One of them is the config volume. If you dont't need an extra config file, You can create a docker volume: + ```bash docker volume create onedrive_conf; ``` @@ -28,9 +30,10 @@ This will create a docker volume labeled 'onedrive_conf', which we will use it l The second one is your data folder that needs to sync with. Keep in mind that: -- The owner of the folder must not be root -- The owner have permission to its parent directory - (because onedrive will try to setup a monitor for the sync folder). +- The owner of the folder must not be root + +- The owner have permission to its parent directory + (because onedrive will try to setup a monitor for the sync folder). ### 3. First run @@ -38,41 +41,47 @@ Onedrive also needs to be authorized with your account. This is done by running docker in interactive mode. **make sure to change onedriveDir to your own.** + ```bash onedriveDir="${HOME}/OneDrive" docker run -it --restart unless-stopped --name onedrive -v onedrive_conf:/onedrive/conf -v "${onedriveDir}:/onedrive/data" driveone/onedrive ``` -- You will be asked to open a specific link using your web browser -- login into your Microsoft Account and give the application the permission -- After giving the permission, you will be redirected to a blank page. -- Copy the URI of the blank page into the application. +- You will be asked to open a specific link using your web browser +- login into your Microsoft Account and give the application the permission +- After giving the permission, you will be redirected to a blank page. +- Copy the URI of the blank page into the application. If your onedrive is working as expected, you can detach from the container with Ctrl+p, Ctrl+q. ### 4. Status, stop, and restart Check if monitor service is running + ```bash docker ps -f name=onedrive ``` Show monitor run logs + ```bash docker logs onedrive ``` Stop running monitor + ```bash docker stop onedrive ``` Resume monitor + ```bash docker start onedrive ``` Unregister onedrive monitor + ```bash docker rm -f onedrive ``` @@ -81,7 +90,7 @@ docker rm -f onedrive Onedrive should run in default configuration, but however you can change your configuration. -First download the default config from [here](https://raw.githubusercontent.com/abraunegg/onedrive/master/config) +First download the default config from [here](https://raw.githubusercontent.com/abraunegg/onedrive/master/config) Then put it into your onedrive_conf volume: `/var/lib/docker/volumes/onedrive_conf/_data` Or you can map your own config folder to config volume (copy stuffs from docker volume first) @@ -89,7 +98,9 @@ Or you can map your own config folder to config volume (copy stuffs from docker The detailed document for the config can be found here: [additional-configuration](https://github.com/abraunegg/onedrive#additional-configuration) ## Run or update with one script + If you are experienced with docker and onedrive, you can use the following script: + ```bash # Update onedriveDir with correct existing OneDrive directory path onedriveDir="${HOME}/OneDrive" @@ -102,6 +113,7 @@ docker run $firstRun --restart unless-stopped --name onedrive -v onedrive_conf:/ ``` ## Build instructions + ```bash git clone https://github.com/abraunegg/onedrive cd onedrive From 54f0279a5ce02bc071cb462ca44aa4e139d25ee3 Mon Sep 17 00:00:00 2001 From: Cauly Kan Date: Wed, 23 Jan 2019 12:46:41 +0800 Subject: [PATCH 06/12] fix wrong build instructions --- docker/README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docker/README.md b/docker/README.md index 26cdd4a4..254a2824 100644 --- a/docker/README.md +++ b/docker/README.md @@ -91,7 +91,11 @@ docker rm -f onedrive Onedrive should run in default configuration, but however you can change your configuration. First download the default config from [here](https://raw.githubusercontent.com/abraunegg/onedrive/master/config) -Then put it into your onedrive_conf volume: `/var/lib/docker/volumes/onedrive_conf/_data` +Then put it into your onedrive_conf volume path, which can be found with: + +```bash +docker volume inspect onedrive_conf +``` Or you can map your own config folder to config volume (copy stuffs from docker volume first) @@ -116,6 +120,7 @@ docker run $firstRun --restart unless-stopped --name onedrive -v onedrive_conf:/ ```bash git clone https://github.com/abraunegg/onedrive -cd onedrive -docker build . -f docker/Dockerfile -t driveone/onedrive +cd onedrive/docker +git clone https://github.com/abraunegg/onedrive +docker build . -t driveone/onedrive ``` From 27cc2c7922c76aed3c0234cf041a0259555e6094 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 23 Jan 2019 23:07:58 +0900 Subject: [PATCH 07/12] fix codacy issues with Dockerfile --- docker/Dockerfile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 2fcec7ef..0f23bb00 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM centos +FROM centos:7 ENV GOSU_VERSION=1.11 RUN yum install -y make git gcc libcurl-devel sqlite-devel && \ @@ -15,12 +15,11 @@ RUN yum install -y make git gcc libcurl-devel sqlite-devel && \ && chmod +x /usr/local/bin/gosu \ && gosu nobody true RUN mkdir -p /onedrive/conf /onedrive/data -ADD onedrive /usr/src/onedrive -RUN . `bash install.sh -a` && \ - cd /usr/src/onedrive && \ - make install.noservice && \ - make clean -ADD entrypoint.sh /entrypoint.sh +COPY onedrive /usr/src/onedrive +RUN . "`bash install.sh -a`" && \ + make -C /usr/src/onedrive install.noservice && \ + make -C /usr/src/onedrive clean +COPY entrypoint.sh /entrypoint.sh VOLUME ["/onedrive/conf"] ENTRYPOINT ["/entrypoint.sh"] From 10475c9d2ca86891082f5b053ed267e7ce5b1821 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 24 Jan 2019 08:54:48 +0900 Subject: [PATCH 08/12] more codacy issues --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 0f23bb00..5a249d3f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,7 +16,7 @@ RUN yum install -y make git gcc libcurl-devel sqlite-devel && \ && gosu nobody true RUN mkdir -p /onedrive/conf /onedrive/data COPY onedrive /usr/src/onedrive -RUN . "`bash install.sh -a`" && \ +RUN . "$(bash install.sh -a)" && \ make -C /usr/src/onedrive install.noservice && \ make -C /usr/src/onedrive clean COPY entrypoint.sh /entrypoint.sh From b437b9607f0cd4d616681dc62fafdada1cf69b87 Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Thu, 24 Jan 2019 18:18:48 +0100 Subject: [PATCH 09/12] Don't clone gitrep again for docker --- docker/Dockerfile => Dockerfile | 2 +- docker/README.md => README.docker.md | 5 ++--- docker/entrypoint.sh => entrypoint.sh | 0 3 files changed, 3 insertions(+), 4 deletions(-) rename docker/Dockerfile => Dockerfile (97%) rename docker/README.md => README.docker.md (92%) rename docker/entrypoint.sh => entrypoint.sh (100%) diff --git a/docker/Dockerfile b/Dockerfile similarity index 97% rename from docker/Dockerfile rename to Dockerfile index 2fcec7ef..836087c4 100644 --- a/docker/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN yum install -y make git gcc libcurl-devel sqlite-devel && \ && chmod +x /usr/local/bin/gosu \ && gosu nobody true RUN mkdir -p /onedrive/conf /onedrive/data -ADD onedrive /usr/src/onedrive +ADD . /usr/src/onedrive RUN . `bash install.sh -a` && \ cd /usr/src/onedrive && \ make install.noservice && \ diff --git a/docker/README.md b/README.docker.md similarity index 92% rename from docker/README.md rename to README.docker.md index 1a03f287..8577337b 100644 --- a/docker/README.md +++ b/README.docker.md @@ -43,8 +43,7 @@ docker start onedrive docker rm -f onedrive ``` ## Build instructions +You can also build your own image instead of pulling the one from dockerhub: ```bash -cd docker -git clone https://github.com/abraunegg/onedrive -docker build . -t driveone/onedrive +docker build . -t onedrive ``` diff --git a/docker/entrypoint.sh b/entrypoint.sh similarity index 100% rename from docker/entrypoint.sh rename to entrypoint.sh From 8d1818d5a25a56dc07b071210dd13278b701ff84 Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Sat, 26 Jan 2019 01:22:07 +0100 Subject: [PATCH 10/12] Make codacy happy by running install.sh slightly different --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 210719bf..8dc5f1f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ RUN yum install -y make git gcc libcurl-devel sqlite-devel && \ && gosu nobody true RUN mkdir -p /onedrive/conf /onedrive/data COPY . /usr/src/onedrive -RUN . "$(bash install.sh -a)" && \ +RUN . `bash install.sh -a` && \ make -C /usr/src/onedrive install.noservice && \ make -C /usr/src/onedrive clean COPY entrypoint.sh /entrypoint.sh From 04c1346578e33807fc1d6f301097b1fa11f1786a Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Sat, 26 Jan 2019 02:07:08 +0100 Subject: [PATCH 11/12] clarify local image with better tag --- README.docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.docker.md b/README.docker.md index e60c0c3e..e1a53dfd 100644 --- a/README.docker.md +++ b/README.docker.md @@ -121,5 +121,5 @@ You can also build your own image instead of pulling the one from dockerhub: ```bash git clone https://github.com/abraunegg/onedrive cd onedrive -docker build . -t onedrive +docker build . -t local-onedrive ``` From a61009bae10e39dc2a084249edda509a35006c20 Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Sat, 26 Jan 2019 02:21:29 +0100 Subject: [PATCH 12/12] New attempt to make codacy happy with bash install.sh --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8dc5f1f8..210719bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ RUN yum install -y make git gcc libcurl-devel sqlite-devel && \ && gosu nobody true RUN mkdir -p /onedrive/conf /onedrive/data COPY . /usr/src/onedrive -RUN . `bash install.sh -a` && \ +RUN . "$(bash install.sh -a)" && \ make -C /usr/src/onedrive install.noservice && \ make -C /usr/src/onedrive clean COPY entrypoint.sh /entrypoint.sh