Browse Source

added Dockefile and entrypoint.sh

It uses the latest available version for libtorrent and builds both libtorrent and qBittorrent with Cmake + ninja

The legal notice must be accepted trought an environment variable called LEGAL and passed to docker when the container is run, to set it true one must set "LEGAL=accept"

PR #16828.
adaptive-webui-19844
Amanuense-del-diavolo 3 years ago committed by GitHub
parent
commit
de8377ab53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 37
      dist/docker/Dockerfile
  2. 67
      dist/docker/Readme.md
  3. 21
      dist/docker/entrypoint.sh

37
dist/docker/Dockerfile vendored

@ -0,0 +1,37 @@
FROM alpine:latest AS builder
ARG BUILD_TYPE
ARG RELEASE
RUN if [ $RELEASE = "master" ] ; \
then \
wget https://github.com/qbittorrent/qBittorrent/archive/refs/heads/master.zip && \
unzip master.zip && \
cd qBittorrent-master ; \
else \
wget https://github.com/qbittorrent/qBittorrent/archive/refs/tags/release-${RELEASE}.tar.gz && \
tar xf release-${RELEASE}.tar.gz && \
cd qBittorrent-release-${RELEASE} ; \
fi && \
apk add --no-cache qt6-qttools-dev g++ libtorrent-rasterbar-dev cmake boost-dev ninja && \
cmake -B build-nox -G "Ninja" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DGUI=OFF -DQT6=ON -DSTACKTRACE=OFF && \
cmake --build build-nox && \
cmake --build build-nox --target install/strip
FROM alpine:latest
COPY --from=builder /usr/local/bin/qbittorrent-nox /usr/bin/qbittorrent-nox
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh && \
apk add --no-cache qt6-qtbase libtorrent-rasterbar
ENV WEBUI_PORT="8080"
EXPOSE 6881 6881/udp 8080
VOLUME /config /downloads
ENTRYPOINT ["/entrypoint.sh"]

67
dist/docker/Readme.md vendored

@ -0,0 +1,67 @@
# Docker Container Name
This Dockerfile allows you to build a qBittorrent-nox container
## Getting Started
### Prerequisities
In order to run this container you'll need docker installed.
* [Windows](https://docs.docker.com/windows/started)
* [OS X](https://docs.docker.com/mac/started/)
* [Linux](https://docs.docker.com/linux/started/)
## Built
in the docker folder run
```shell
release="4.2.0" ; sudo docker build --build-arg BUILD_TYPE=Release --build-arg RELEASE=$release -t qbittorrent-nox:$release --rm .
```
where:
* the `release` variable is the specific tagged version you want to build
* the `BUILD_TYPE` argument is the build you want to create `Debug` or `Release`
* the `RELEASE` argument works as the but is the actual argument given to docker, in the above script is defined by the `release` variable
### Usage
#### Container Variables
there is one important variable to run the container:
* the `LEGAL` varible defines if you accept the Legal Notice, put accept as a value only if you understand and accept the Legal Notice
#### Volumes
there are two main locations:
* `downloads` contains the files downloaded by qBittorrent
* `config` contains qBittorrent configurations
```shell
docker run give.example.org/of/your/container:v0.2.1 parameters
```
#### Network
on the port `8080` the webinterface is run
#### RUN
To start the the docker image simply run
```shell
docker run --env LEGAL=accept -p 8080:8080 -v /your/path/config:/config -v /your/path/download:/downloads --name qBittorrent qbittorrent-nox:4.2.0
```
to stop the container
```shell
docker stop qBittorrent
```

21
dist/docker/entrypoint.sh vendored

@ -0,0 +1,21 @@
#!/bin/sh
if [ ! -f /config/qBittorrent/qBittorrent.conf ]; then
mkdir -p /config/qBittorrent/
cat << EOF > /config/qBittorrent/qBittorrent.conf
[BitTorrent]
Session\DefaultSavePath=/downloads
Session\TempPath=/downloads/temp
[LegalNotice]
Accepted=false
EOF
fi
if [ "$LEGAL" = "accept" ] ; then
sed -i '/^\[LegalNotice\]$/{$!{N;s|\(\[LegalNotice\]\nAccepted=\).*|\1true|}}' /config/qBittorrent/qBittorrent.conf
else
sed -i '/^\[LegalNotice\]$/{$!{N;s|\(\[LegalNotice\]\nAccepted=\).*|\1false|}}' /config/qBittorrent/qBittorrent.conf
fi
HOME="/config" XDG_CONFIG_HOME="/config" XDG_DATA_HOME="/config" qbittorrent-nox --webui-port=$WEBUI_PORT
Loading…
Cancel
Save