From 54fe139a4677bd95450cf2d61a77049ce4f81da6 Mon Sep 17 00:00:00 2001 From: Mogeko Date: Thu, 18 Nov 2021 00:14:34 +0000 Subject: [PATCH 1/6] build: set up Makefile --- .devcontainer/Dockerfile | 4 ++-- .gitignore | 3 +++ Makefile | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 Makefile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index d8239fe..60584df 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -37,5 +37,5 @@ ENTRYPOINT [ "/usr/local/share/docker-init.sh" ] CMD [ "sleep", "infinity" ] # [Optional] Uncomment this section to install additional OS packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends \ No newline at end of file +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends make \ No newline at end of file diff --git a/.gitignore b/.gitignore index 830f56e..7a9ac5f 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,6 @@ $RECYCLE.BIN/ *.lnk # End of https://www.toptal.com/developers/gitignore/api/macos,windows,linux + +# Custom dir for test +tests/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..33c15a3 --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +CMD = /usr/bin/docker +IMAGE = mogeko/qbittorrent +VERSION = 4.3.8 +PORT = 8080 +CONF_DIR = $(shell pwd)/tests/config +DL_DIR = $(shell pwd)/tests/data + +.PHONY: all build run help + +all: build run + +build: + @$(CMD) build . \ + --build-arg VERSION=$(VERSION) \ + --tag $(IMAGE) + +run: id := $(shell head -200 /dev/urandom | cksum | cut -f1 -d " ") +run: + @-$(CMD) run -it \ + --name qbt-$(id) \ + -p 6881:6881 \ + -p 6881:6881/udp \ + -p $(PORT):8080 \ + -v $(CONF_DIR):/config \ + -v $(DL_DIR):/downloads \ + $(IMAGE) + @$(CMD) rm -f qbt-$(id) + +help: id := $(shell head -200 /dev/urandom | cksum | cut -f1 -d " ") +help: + @-$(CMD) run -it --name qbt-$(id) $(IMAGE) --help + @$(CMD) rm -f qbt-$(id) + +rm: clean From 79b62aba7fbde000ab70c6406cc5e035459177e8 Mon Sep 17 00:00:00 2001 From: Mogeko Date: Thu, 18 Nov 2021 00:24:13 +0000 Subject: [PATCH 2/6] build: creat an example dir for test --- .gitignore | 2 - Makefile | 4 +- example/config/qBittorrent-data.conf | 2 + example/config/qBittorrent.conf | 61 ++++++++++++++++++++++++++++ example/config/rss/feeds.json | 2 + example/config/watched_folders.json | 2 + example/data/.gitkeep | 0 7 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 example/config/qBittorrent-data.conf create mode 100644 example/config/qBittorrent.conf create mode 100644 example/config/rss/feeds.json create mode 100644 example/config/watched_folders.json create mode 100644 example/data/.gitkeep diff --git a/.gitignore b/.gitignore index 7a9ac5f..7edf369 100644 --- a/.gitignore +++ b/.gitignore @@ -74,5 +74,3 @@ $RECYCLE.BIN/ # End of https://www.toptal.com/developers/gitignore/api/macos,windows,linux -# Custom dir for test -tests/ diff --git a/Makefile b/Makefile index 33c15a3..22cbc4e 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,8 @@ CMD = /usr/bin/docker IMAGE = mogeko/qbittorrent VERSION = 4.3.8 PORT = 8080 -CONF_DIR = $(shell pwd)/tests/config -DL_DIR = $(shell pwd)/tests/data +CONF_DIR = $(shell pwd)/example/config +DL_DIR = $(shell pwd)/example/data .PHONY: all build run help diff --git a/example/config/qBittorrent-data.conf b/example/config/qBittorrent-data.conf new file mode 100644 index 0000000..b0af648 --- /dev/null +++ b/example/config/qBittorrent-data.conf @@ -0,0 +1,2 @@ +[Stats] +AllStats=@Variant(\0\0\0\x1c\0\0\0\x2\0\0\0\x12\0\x41\0l\0l\0t\0i\0m\0\x65\0\x44\0L\0\0\0\x5\0\0\0\0\0\0\x1a\xb0\0\0\0\x12\0\x41\0l\0l\0t\0i\0m\0\x65\0U\0L\0\0\0\x5\0\0\0\0\0\0&\xb8) diff --git a/example/config/qBittorrent.conf b/example/config/qBittorrent.conf new file mode 100644 index 0000000..16b1133 --- /dev/null +++ b/example/config/qBittorrent.conf @@ -0,0 +1,61 @@ +[AutoRun] +enabled=false +program= + +[Core] +AutoDeleteAddedTorrentFile=Never + +[LegalNotice] +Accepted=true + +[Network] +Cookies=@Invalid() + +[Preferences] +Advanced\RecheckOnCompletion=false +Advanced\trackerPort=9000 +Connection\PortRangeMin=6881 +Connection\ResolvePeerCountries=true +Connection\UPnP=false +Downloads\SavePath=/downloads/ +Downloads\TempPath=/downloads/incomplete/ +DynDNS\DomainName=changeme.dyndns.org +DynDNS\Enabled=false +DynDNS\Password= +DynDNS\Service=0 +DynDNS\Username= +General\Locale=zh +MailNotification\email= +MailNotification\enabled=false +MailNotification\password= +MailNotification\req_auth=true +MailNotification\req_ssl=false +MailNotification\sender=qBittorrent_notification@example.com +MailNotification\smtp_server=smtp.changeme.com +MailNotification\username= +Queueing\QueueingEnabled=true +WebUI\Address=* +WebUI\AlternativeUIEnabled=false +WebUI\AuthSubnetWhitelistEnabled=false +WebUI\BanDuration=3600 +WebUI\CSRFProtection=true +WebUI\ClickjackingProtection=true +WebUI\CustomHTTPHeaders= +WebUI\CustomHTTPHeadersEnabled=false +WebUI\HTTPS\CertificatePath= +WebUI\HTTPS\Enabled=false +WebUI\HTTPS\KeyPath= +WebUI\HostHeaderValidation=true +WebUI\LocalHostAuth=true +WebUI\MaxAuthenticationFailCount=5 +WebUI\Port=8080 +WebUI\RootFolder= +WebUI\SecureCookie=true +WebUI\ServerDomains=* +WebUI\SessionTimeout=3600 +WebUI\UseUPnP=true +WebUI\Username=admin + +[RSS] +AutoDownloader\DownloadRepacks=true +AutoDownloader\SmartEpisodeFilter=s(\\d+)e(\\d+), (\\d+)x(\\d+), "(\\d{4}[.\\-]\\d{1,2}[.\\-]\\d{1,2})", "(\\d{1,2}[.\\-]\\d{1,2}[.\\-]\\d{4})" diff --git a/example/config/rss/feeds.json b/example/config/rss/feeds.json new file mode 100644 index 0000000..2c63c08 --- /dev/null +++ b/example/config/rss/feeds.json @@ -0,0 +1,2 @@ +{ +} diff --git a/example/config/watched_folders.json b/example/config/watched_folders.json new file mode 100644 index 0000000..2c63c08 --- /dev/null +++ b/example/config/watched_folders.json @@ -0,0 +1,2 @@ +{ +} diff --git a/example/data/.gitkeep b/example/data/.gitkeep new file mode 100644 index 0000000..e69de29 From ff20a896a42de1668068247ed8754967a36d1056 Mon Sep 17 00:00:00 2001 From: Mogeko Date: Thu, 18 Nov 2021 00:30:31 +0000 Subject: [PATCH 3/6] docs(readme): add more badges --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2382513..4ba8001 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # docker-qbittorrent -[![ci_icon]][ci_link] +[![ci_icon]][ci_link] [![image_size]][docker_link] Docker image for qBittorrent. @@ -90,6 +90,8 @@ The code in this project is released under the [GPL-3.0 License][license]. [ci_icon]: https://github.com/mogeko/docker-qbittorrent/actions/workflows/auto-update.yml/badge.svg [ci_link]: https://github.com/mogeko/docker-qbittorrent/actions/workflows/auto-update.yml +[image_size]: https://img.shields.io/docker/image-size/mogeko/qbittorrent?logo=docker +[docker_link]: https://hub.docker.com/r/mogeko/qbittorrent From a04e097c050f0b4f8cb6f5370c976cd5abe366da Mon Sep 17 00:00:00 2001 From: Mogeko Date: Thu, 18 Nov 2021 00:33:07 +0000 Subject: [PATCH 4/6] build(ci): build image by CI --- .github/workflows/build.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a9761bb..d3abcbd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,19 @@ jobs: env: ALPINE_PKG_URL: https://pkgs.alpinelinux.org/package/edge/testing/x86_64/qbittorrent-nox + build: + runs-on: ubuntu-latest + needs: check + permissions: + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Build + run: make build + meta: runs-on: ubuntu-latest needs: check From b0b91f68dff120679b9e65716884e8727b3b5cbd Mon Sep 17 00:00:00 2001 From: Mogeko Date: Thu, 18 Nov 2021 00:34:36 +0000 Subject: [PATCH 5/6] fix(ci): fix a syntax error --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3abcbd..b51eb3b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,6 @@ jobs: build: runs-on: ubuntu-latest needs: check - permissions: steps: - name: Checkout uses: actions/checkout@v2 From 7eb33238912c9a904b53b278f71f3a637f93e151 Mon Sep 17 00:00:00 2001 From: Mogeko Date: Thu, 18 Nov 2021 00:37:12 +0000 Subject: [PATCH 6/6] fix: set the correct version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 22cbc4e..6feec68 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ CMD = /usr/bin/docker IMAGE = mogeko/qbittorrent -VERSION = 4.3.8 +VERSION = 4.3.8-r0 PORT = 8080 CONF_DIR = $(shell pwd)/example/config DL_DIR = $(shell pwd)/example/data