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 b51eb3b..81fba07 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,22 +17,10 @@ jobs: - name: Check version id: check_ver run: | - NEW_VER=$(curl -s "${ALPINE_PKG_URL}" | grep -Po "(\d+\.)+\d+\-r\d+" | head -1) - 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: - ALPINE_PKG_URL: https://pkgs.alpinelinux.org/package/edge/testing/x86_64/qbittorrent-nox - - build: - runs-on: ubuntu-latest - needs: check - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Build - run: make build + REPO_TAGS: https://github.com/qbittorrent/qBittorrent/tags meta: runs-on: ubuntu-latest @@ -56,7 +44,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 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 234018e..ea255a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,44 @@ -FROM alpine:edge - -ARG VERSION +FROM alpine:3.14 as libtorrent_builder RUN apk add --no-cache \ - -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \ - qbittorrent-nox=${VERSION} + autoconf automake binutils boost-dev cppunit-dev libtool linux-headers ncurses-dev openssl-dev zlib-dev \ + build-base clang tar + +WORKDIR /workspace + +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 + +FROM alpine:3.14 as qbittorrent_builder + +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:3.14 + +RUN apk add --no-cache busybox libgcc openssl qt5-qtbase zlib + +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 6feec68..9fdd6ba 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ +LIBTORRENT_VERSION = $(shell jq -r '.libtorrent' ./latest.json) +QBITTORRENT_VERSION = $(shell jq -r '.qbittorrent' ./latest.json) + CMD = /usr/bin/docker IMAGE = mogeko/qbittorrent -VERSION = 4.3.8-r0 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 @@ -{ -} 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 +}