Skip to content

Commit

Permalink
Update Docker files for Raspberry Pi (#1335)
Browse files Browse the repository at this point in the history
* Revert PR #1259
* Provide dedicated armhf & aarch64 Dockerfiles
* Document updates
  • Loading branch information
abraunegg authored Mar 14, 2021
1 parent b8717fb commit 1060629
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 16 deletions.
21 changes: 21 additions & 0 deletions contrib/docker/Dockerfile-aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*-Dockerfile-*-
FROM debian:stretch
RUN apt update && \
apt install -y build-essential curl libcurl4-openssl-dev libsqlite3-dev pkg-config wget git
RUN wget https://github.com/ldc-developers/ldc/releases/download/v1.16.0/ldc2-1.16.0-linux-aarch64.tar.xz && \
tar -xvf ldc2-1.16.0-linux-aarch64.tar.xz
COPY . /usr/src/onedrive
RUN cd /usr/src/onedrive/ && \
./configure DC=/ldc2-1.16.0-linux-aarch64/bin/ldmd2 && \
make clean && \
make && \
make install

FROM debian:stretch-slim
ENTRYPOINT ["/entrypoint.sh"]
RUN apt update && \
apt install -y gosu libcurl3 libsqlite3-0 && \
rm -rf /var/*/apt && \
mkdir -p /onedrive/conf /onedrive/data
COPY contrib/docker/entrypoint.sh /
COPY --from=0 /usr/local/bin/onedrive /usr/local/bin/
7 changes: 3 additions & 4 deletions contrib/docker/Dockerfile-rpi
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# -*-Dockerfile-*-
FROM debian:stretch
ARG ARCH armhf # or aarch64
RUN apt update && \
apt install -y build-essential curl libcurl4-openssl-dev libsqlite3-dev pkg-config wget git
RUN wget https://github.com/ldc-developers/ldc/releases/download/v1.16.0/ldc2-1.16.0-linux-${ARCH}.tar.xz && \
tar -xvf ldc2-1.16.0-linux-${ARCH}.tar.xz
RUN wget https://github.com/ldc-developers/ldc/releases/download/v1.16.0/ldc2-1.16.0-linux-armhf.tar.xz && \
tar -xvf ldc2-1.16.0-linux-armhf.tar.xz
COPY . /usr/src/onedrive
RUN cd /usr/src/onedrive/ && \
./configure DC=/ldc2-1.16.0-linux-${ARCH}/bin/ldmd2 && \
./configure DC=/ldc2-1.16.0-linux-armhf/bin/ldmd2 && \
make clean && \
make && \
make install
Expand Down
32 changes: 20 additions & 12 deletions docs/Docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ docker rm -f onedrive
## Advanced Setup

### 5. Docker-compose

Also supports docker-compose schemas > 3.
In the following example it is assumed you have a `ONEDRIVE_DATA_DIR` environment variable and a `onedrive_conf` volume.
However, you can also use bind mounts for the configuration folder, e.g. `export ONEDRIVE_CONF="${HOME}/OneDriveConfig"`.
Expand All @@ -138,7 +137,6 @@ services:
Note that you still have to perform step 3: First Run.

### 6. Edit the config

The 'onedrive' client should run in default configuration, however you can change this default configuration by placing a custom config file in the `onedrive_conf` docker volume. First download the default config from [here](https://raw.githubusercontent.com/abraunegg/onedrive/master/config)
Then put it into your onedrive_conf volume path, which can be found with:

Expand All @@ -151,7 +149,6 @@ Or you can map your own config folder to the config volume. Make sure to copy al
The detailed document for the config can be found here: [Configuration](https://github.com/abraunegg/onedrive/blob/master/docs/USAGE.md#configuration)

### 7. Sync multiple accounts

There are many ways to do this, the easiest is probably to
1. Create a second docker config volume (replace `Work` with your desired name): `docker volume create onedrive_conf_Work`
2. And start a second docker monitor container (again replace `Work` with your desired name):
Expand All @@ -162,7 +159,6 @@ docker run -it --restart unless-stopped --name onedrive_Work -v onedrive_conf_Wo
```

## Run or update with one script

If you are experienced with docker and onedrive, you can use the following script:

```bash
Expand All @@ -178,8 +174,6 @@ docker run $firstRun --restart unless-stopped --name onedrive -v onedrive_conf:/


## Environment Variables


| Variable | Purpose | Sample Value |
| ---------------- | --------------------------------------------------- |:-------------:|
| <B>ONEDRIVE_UID</B> | UserID (UID) to run as | 1000 |
Expand Down Expand Up @@ -219,7 +213,7 @@ docker container run -e ONEDRIVE_LOGOUT=1 -v onedrive_conf:/onedrive/conf -v "${
* Build environment must have at least 1GB of memory & 2GB swap space

There are 2 ways to validate this requirement:
* Modify the file `/etc/dphys-swapfile` and edit the `CONF_SWAPSIZE`, for example: `CONF_SWAPSIZE=2024`. A reboot is required to make this change effective.
* Modify the file `/etc/dphys-swapfile` and edit the `CONF_SWAPSIZE`, for example: `CONF_SWAPSIZE=2048`. A reboot is required to make this change effective.
* Dynamically allocate a swapfile for building:
```bash
cd /var
Expand All @@ -235,7 +229,7 @@ swapon -s
free -h
```

### Building the Docker image
### Building a custom Docker image
You can also build your own image instead of pulling the one from [hub.docker.com](https://hub.docker.com/r/driveone/onedrive):
```bash
git clone https://github.com/abraunegg/onedrive
Expand All @@ -248,18 +242,32 @@ Dockerfile-stretch or Dockerfile-alpine. These [multi-stage builder
pattern](https://docs.docker.com/develop/develop-images/multistage-build/)
Dockerfiles require Docker version at least 17.05.

#### How to build a Docker image based on Debian Stretch

#### How to build and run a custom Docker image based on Debian Stretch
``` bash
docker build . -t local-ondrive-stretch -f contrib/docker/Dockerfile-stretch
docker container run -v onedrive_conf:/onedrive/conf -v "${ONEDRIVE_DATA_DIR}:/onedrive/data" local-ondrive-stretch:latest
```
#### How to build a Docker image based on Alpine Linux

#### How to build and run a custom Docker image based on Alpine Linux
``` bash
docker build . -t local-ondrive-alpine -f contrib/docker/Dockerfile-alpine
docker container run -v onedrive_conf:/onedrive/conf -v "${ONEDRIVE_DATA_DIR}:/onedrive/data" local-ondrive-alpine:latest
```
#### How to build a Docker image for ARMHF (Raspberry Pi)

#### How to build and run a custom Docker image for ARMHF (Raspberry Pi)
Compatible with:
* Raspberry Pi
* Raspberry Pi 2
* Raspberry Pi Zero
* Raspberry Pi 3
* Raspberry Pi 4
``` bash
docker build . -t local-onedrive-rpi -f contrib/docker/Dockerfile-rpi
docker container run -v onedrive_conf:/onedrive/conf -v "${ONEDRIVE_DATA_DIR}:/onedrive/data" local-ondrive-rpi:latest
```

#### How to build and run a custom Docker image for AARCH64 Platforms
``` bash
docker build . -t local-onedrive-aarch64 -f contrib/docker/Dockerfile-aarch64
docker container run -v onedrive_conf:/onedrive/conf -v "${ONEDRIVE_DATA_DIR}:/onedrive/data" local-onedrive-aarch64:latest
```

0 comments on commit 1060629

Please sign in to comment.