From 17e7c7a7fade07cf4e0ca8ebb21a1975b5010de5 Mon Sep 17 00:00:00 2001 From: Mogeko Date: Thu, 18 Nov 2021 00:41:32 +0000 Subject: [PATCH 1/5] feat: local compilation Qbittorrent-Nox --- Dockerfile | 22 ++++++++++++++++++---- Makefile | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 234018e..aa09f27 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,24 @@ -FROM alpine:edge +FROM alpine:edge as builder + +RUN apk add --no-cache boost-dev build-base clang qt5-qtbase-dev qt5-qttools-dev libtorrent-rasterbar-dev tar + +WORKDIR /workspace ARG VERSION -RUN apk add --no-cache \ - -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \ - qbittorrent-nox=${VERSION} +ADD https://github.com/qbittorrent/qBittorrent/archive/refs/tags/release-${VERSION}.tar.gz /workspace + +RUN tar -zxf release-${VERSION}.tar.gz -C . \ + && mv qBittorrent-release-${VERSION}/* . \ + && ./configure --prefix=/workspace --disable-gui \ + && CC=clang make \ + && make install + +FROM alpine:edge + +RUN apk add --no-cache busybox libcrypto3 libgcc libstdc++ libtorrent-rasterbar musl qt5-qtbase zlib + +COPY --from=builder /workspace/bin/qbittorrent-nox /usr/bin/qbittorrent-nox ADD --chown=1000:100 root / diff --git a/Makefile b/Makefile index 6feec68..22cbc4e 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ CMD = /usr/bin/docker IMAGE = mogeko/qbittorrent -VERSION = 4.3.8-r0 +VERSION = 4.3.8 PORT = 8080 CONF_DIR = $(shell pwd)/example/config DL_DIR = $(shell pwd)/example/data From 87a1e93583628c84c13f805339f58c5ac82d4e4f Mon Sep 17 00:00:00 2001 From: Mogeko Date: Thu, 18 Nov 2021 15:28:31 +0000 Subject: [PATCH 2/5] feat: compile libtorrent locally --- .github/workflows/build.yml | 6 ++-- .gitignore | 3 ++ Dockerfile | 42 ++++++++++++++++++++-------- Makefile | 9 +++--- example/config/qBittorrent-data.conf | 2 -- example/config/rss/feeds.json | 2 -- example/config/watched_folders.json | 2 -- 7 files changed, 43 insertions(+), 23 deletions(-) delete mode 100644 example/config/qBittorrent-data.conf delete mode 100644 example/config/rss/feeds.json delete mode 100644 example/config/watched_folders.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b51eb3b..8700f9d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,14 +17,16 @@ jobs: - name: Check version id: check_ver run: | - NEW_VER=$(curl -s "${ALPINE_PKG_URL}" | grep -Po "(\d+\.)+\d+\-r\d+" | head -1) + RAW_VER=$(curl -s "${REPO_TAGS}" | grep -Po "release-(\d+\.){2}\d+\.zip" | head -1) + NEW_VER="${RAW_VER:8:5}-r0" echo "::set-output name=new_ver::${NEW_VER}" env: - ALPINE_PKG_URL: https://pkgs.alpinelinux.org/package/edge/testing/x86_64/qbittorrent-nox + REPO_TAGS: https://github.com/qbittorrent/qBittorrent/tags build: runs-on: ubuntu-latest needs: check + if: ${{ github.event_name == 'pull_request' }} steps: - name: Checkout uses: actions/checkout@v2 diff --git a/.gitignore b/.gitignore index 7edf369..52e3aee 100644 --- a/.gitignore +++ b/.gitignore @@ -74,3 +74,6 @@ $RECYCLE.BIN/ # End of https://www.toptal.com/developers/gitignore/api/macos,windows,linux +# Custom example dirs +example/config +!example/config/qBittorrent.conf diff --git a/Dockerfile b/Dockerfile index aa09f27..ea255a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,44 @@ -FROM alpine:edge as builder +FROM alpine:3.14 as libtorrent_builder -RUN apk add --no-cache boost-dev build-base clang qt5-qtbase-dev qt5-qttools-dev libtorrent-rasterbar-dev tar +RUN apk add --no-cache \ + autoconf automake binutils boost-dev cppunit-dev libtool linux-headers ncurses-dev openssl-dev zlib-dev \ + build-base clang tar WORKDIR /workspace -ARG VERSION +ARG LIBTORRENT_VERSION +ADD https://github.com/arvidn/libtorrent/archive/refs/tags/v${LIBTORRENT_VERSION}.tar.gz /workspace +RUN tar -zxf v${LIBTORRENT_VERSION}.tar.gz -C . \ + && cd libtorrent-${LIBTORRENT_VERSION} \ + && ./autotool.sh \ + && ./configure CXXFLAGS="-std=c++14" --prefix=/workspace/pkg --with-libiconv \ + && CC=clang make -j$(nproc) \ + && make install-strip -ADD https://github.com/qbittorrent/qBittorrent/archive/refs/tags/release-${VERSION}.tar.gz /workspace +FROM alpine:3.14 as qbittorrent_builder -RUN tar -zxf release-${VERSION}.tar.gz -C . \ - && mv qBittorrent-release-${VERSION}/* . \ - && ./configure --prefix=/workspace --disable-gui \ - && CC=clang make \ +RUN apk add --no-cache \ + boost-dev qt5-qtbase-dev qt5-qttools-dev \ + build-base clang tar + +WORKDIR /workspace + +COPY --from=libtorrent_builder /workspace/pkg /usr + +ARG QBITTORRENT_VERSION +ADD https://github.com/qbittorrent/qBittorrent/archive/refs/tags/release-${QBITTORRENT_VERSION}.tar.gz /workspace +RUN tar -zxf release-${QBITTORRENT_VERSION}.tar.gz -C . \ + && cd qBittorrent-release-${QBITTORRENT_VERSION} \ + && ./configure --prefix=/workspace/pkg --disable-gui \ + && CC=clang make -j$(nproc) \ && make install -FROM alpine:edge +FROM alpine:3.14 -RUN apk add --no-cache busybox libcrypto3 libgcc libstdc++ libtorrent-rasterbar musl qt5-qtbase zlib +RUN apk add --no-cache busybox libgcc openssl qt5-qtbase zlib -COPY --from=builder /workspace/bin/qbittorrent-nox /usr/bin/qbittorrent-nox +COPY --from=libtorrent_builder /workspace/pkg /usr +COPY --from=qbittorrent_builder /workspace/pkg /usr ADD --chown=1000:100 root / diff --git a/Makefile b/Makefile index 22cbc4e..3402a45 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ +LIBTORRENT_VERSION = 1.2.14 +QBITTORRENT_VERSION = 4.3.8 + CMD = /usr/bin/docker IMAGE = mogeko/qbittorrent -VERSION = 4.3.8 PORT = 8080 CONF_DIR = $(shell pwd)/example/config DL_DIR = $(shell pwd)/example/data @@ -11,7 +13,8 @@ all: build run build: @$(CMD) build . \ - --build-arg VERSION=$(VERSION) \ + --build-arg LIBTORRENT_VERSION=$(LIBTORRENT_VERSION) \ + --build-arg QBITTORRENT_VERSION=$(QBITTORRENT_VERSION) \ --tag $(IMAGE) run: id := $(shell head -200 /dev/urandom | cksum | cut -f1 -d " ") @@ -30,5 +33,3 @@ 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 diff --git a/example/config/qBittorrent-data.conf b/example/config/qBittorrent-data.conf deleted file mode 100644 index b0af648..0000000 --- a/example/config/qBittorrent-data.conf +++ /dev/null @@ -1,2 +0,0 @@ -[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/rss/feeds.json b/example/config/rss/feeds.json deleted file mode 100644 index 2c63c08..0000000 --- a/example/config/rss/feeds.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} diff --git a/example/config/watched_folders.json b/example/config/watched_folders.json deleted file mode 100644 index 2c63c08..0000000 --- a/example/config/watched_folders.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} From a4378fd32e8568d3574041048207ed312f02be97 Mon Sep 17 00:00:00 2001 From: Mogeko Date: Thu, 18 Nov 2021 16:33:47 +0000 Subject: [PATCH 3/5] build(ci)L update check function --- .github/workflows/auto-update.yml | 14 +++++++------- .github/workflows/build.yml | 7 +++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml index a679e14..58cce5a 100644 --- a/.github/workflows/auto-update.yml +++ b/.github/workflows/auto-update.yml @@ -14,14 +14,13 @@ jobs: - name: Check version id: check_ver run: | - get_ver() (curl -s "$@" | grep -Po "(\d+\.)+\d+\-r\d+" | head -1) - OLD_VER=$(get_ver ${GHCO_URL}) - NEW_VER=$(get_ver ${ALPINE_PKG_URL}) - echo "::set-output name=old_ver::${OLD_VER}" - echo "::set-output name=new_ver::${NEW_VER}" + OLD_TAG=$(curl -s "${GHCO_URL}" | grep -Po "(\d+\.)+\d+\-r\d+" | head -1) + NEW_TAG=$(curl -s "${REPO_TAGS}" | grep -Po "release-(\d+\.){2}\d+\.zip" | head -1) + echo "::set-output name=old_ver::${OLD_TAG:0:5}" + echo "::set-output name=new_ver::${NEW_TAG:8:5}" env: - ALPINE_PKG_URL: https://pkgs.alpinelinux.org/package/edge/testing/x86_64/qbittorrent-nox GHCO_URL: https://github.com/mogeko/docker-qbittorrent/pkgs/container/qbittorrent + REPO_TAGS: https://github.com/qbittorrent/qBittorrent/tags build: runs-on: ubuntu-latest @@ -71,7 +70,8 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | - VERSION=${{ needs.check.outputs.new_ver }} + QBITTORRENT_VERSION=${{ needs.check.outputs.new_ver }}-r0 + LIBTORRENT_VERSION=1.2.14 - name: Save metadata run: echo ${{ toJSON(steps.build.outputs.metadata) }} > ${{ github.workspace }}/meta.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8700f9d..dc732e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,9 +17,8 @@ jobs: - name: Check version id: check_ver run: | - RAW_VER=$(curl -s "${REPO_TAGS}" | grep -Po "release-(\d+\.){2}\d+\.zip" | head -1) - NEW_VER="${RAW_VER:8:5}-r0" - echo "::set-output name=new_ver::${NEW_VER}" + NEW_TAG=$(curl -s "${REPO_TAGS}" | grep -Po "release-(\d+\.){2}\d+\.zip" | head -1) + echo "::set-output name=new_ver::${NEW_TAG:8:5}" env: REPO_TAGS: https://github.com/qbittorrent/qBittorrent/tags @@ -58,7 +57,7 @@ jobs: tags: | type=edge type=schedule,pattern={{date 'YYYYMMDD'}} - type=raw,${{ needs.check.outputs.new_ver }} + type=raw,${{ needs.check.outputs.new_ver }}-r0 type=raw,latest - name: Save status From bcd045710f45fbfd1ce735f3f2eeb177ac883540 Mon Sep 17 00:00:00 2001 From: Mogeko Date: Thu, 18 Nov 2021 16:59:00 +0000 Subject: [PATCH 4/5] build: store version data with latest.json --- Makefile | 4 ++-- latest.json | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 latest.json diff --git a/Makefile b/Makefile index 3402a45..9fdd6ba 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -LIBTORRENT_VERSION = 1.2.14 -QBITTORRENT_VERSION = 4.3.8 +LIBTORRENT_VERSION = $(shell jq -r '.libtorrent' ./latest.json) +QBITTORRENT_VERSION = $(shell jq -r '.qbittorrent' ./latest.json) CMD = /usr/bin/docker IMAGE = mogeko/qbittorrent diff --git a/latest.json b/latest.json new file mode 100644 index 0000000..7541025 --- /dev/null +++ b/latest.json @@ -0,0 +1,5 @@ +{ + "qbittorrent": "4.3.8", + "libtorrent": "1.2.14", + "pkgrel": 1 +} From c7ad5fa9076810f3559c3582dbc7d38f052d54f6 Mon Sep 17 00:00:00 2001 From: Mogeko Date: Thu, 18 Nov 2021 17:00:17 +0000 Subject: [PATCH 5/5] build(ci): desable build --- .github/workflows/build.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc732e1..81fba07 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,19 +22,6 @@ jobs: env: REPO_TAGS: https://github.com/qbittorrent/qBittorrent/tags - build: - runs-on: ubuntu-latest - needs: check - if: ${{ github.event_name == 'pull_request' }} - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Build - run: make build - meta: runs-on: ubuntu-latest needs: check