mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-03 06:02:29 -06:00
Improve Docker build
* Improves code readability. * Improve documentation. * Fix "docker stop" doesn't terminate qbt gracefully which could lead to data corruption. * Provide correct/working bittorrent listening port by default. * Make use of qbt profile option instead of hacking environment variables. * Simplify build steps. PR #16976.
This commit is contained in:
68
dist/docker/Dockerfile
vendored
68
dist/docker/Dockerfile
vendored
@@ -1,37 +1,51 @@
|
||||
|
||||
# image for building
|
||||
FROM alpine:latest AS builder
|
||||
|
||||
ARG BUILD_TYPE
|
||||
ARG RELEASE
|
||||
ARG QBT_VERSION
|
||||
|
||||
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
|
||||
# alpine linux qbittorrent package: https://git.alpinelinux.org/aports/tree/community/qbittorrent/APKBUILD
|
||||
|
||||
RUN \
|
||||
apk --update-cache add \
|
||||
boost-dev \
|
||||
cmake \
|
||||
g++ \
|
||||
libtorrent-rasterbar-dev \
|
||||
ninja \
|
||||
qt6-qtbase-dev \
|
||||
qt6-qttools-dev
|
||||
|
||||
RUN \
|
||||
if [ "$QBT_VERSION" = "devel" ]; 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-${QBT_VERSION}.tar.gz" && \
|
||||
tar -xf "release-${QBT_VERSION}.tar.gz" && \
|
||||
cd "qBittorrent-release-${QBT_VERSION}" ; \
|
||||
fi && \
|
||||
cmake \
|
||||
-B build \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DGUI=OFF \
|
||||
-DQT6=ON \
|
||||
-DSTACKTRACE=OFF && \
|
||||
cmake --build build && \
|
||||
cmake --install build
|
||||
|
||||
# image for running
|
||||
FROM alpine:latest
|
||||
|
||||
RUN \
|
||||
apk --no-cache add \
|
||||
libtorrent-rasterbar \
|
||||
qt6-qtbase \
|
||||
tini
|
||||
|
||||
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 /data /downloads
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
ENTRYPOINT ["/sbin/tini", "-g", "--", "/entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user