From 117aaf0ceb227d340a8373298a3efa339453522f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20K=C3=BChn?= Date: Sun, 16 Dec 2018 12:57:08 +0100 Subject: [PATCH] Fix builds on ARM arch but keeping ARM cross builds. Fix #638. --- Dockerfile.armhf | 4 - DockerfileCrossBuild.armhf | 131 +++++++++++++++++++++++++ README.md | 16 +-- docker-compose-armhf.yml | 16 +-- plugins/rss/Dockerfile.armhf | 4 - plugins/rss/DockerfileCrossBuild.armhf | 22 +++++ proxy/Dockerfile.armhf | 4 - proxy/DockerfileCrossBuild.armhf | 22 +++++ 8 files changed, 188 insertions(+), 31 deletions(-) create mode 100644 DockerfileCrossBuild.armhf create mode 100644 plugins/rss/DockerfileCrossBuild.armhf create mode 100644 proxy/DockerfileCrossBuild.armhf diff --git a/Dockerfile.armhf b/Dockerfile.armhf index be21da6a4..084c56cb4 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,8 +1,6 @@ FROM resin/rpi-raspbian:stretch MAINTAINER Kristian Haugene -RUN [ "cross-build-start" ] - VOLUME /data VOLUME /config @@ -125,5 +123,3 @@ ENV OPENVPN_USERNAME=**None** \ # Expose port and run EXPOSE 9091 CMD ["dumb-init", "/etc/openvpn/start.sh"] - -RUN [ "cross-build-end" ] diff --git a/DockerfileCrossBuild.armhf b/DockerfileCrossBuild.armhf new file mode 100644 index 000000000..b141c7928 --- /dev/null +++ b/DockerfileCrossBuild.armhf @@ -0,0 +1,131 @@ +# This Dockerfile is for building ARM images on x64 machine like Docker Hub + +FROM resin/rpi-raspbian:stretch +MAINTAINER Kristian Haugene + +RUN [ "cross-build-start" ] + +VOLUME /data +VOLUME /config + +# Update packages and install software +RUN apt-get update \ + && apt-get -y install transmission-cli transmission-common transmission-daemon \ + && apt-get install -y dumb-init unzip openvpn curl ufw git tinyproxy jq \ + && curl -L -o /tmp/release.zip https://github.com/Secretmapper/combustion/archive/release.zip \ + && unzip /tmp/release.zip -d /opt/transmission-ui/ \ + && rm /tmp/release.zip \ + && git clone git://github.com/endor/kettu.git /opt/transmission-ui/kettu \ + && mkdir /opt/transmission-ui/transmission-web-control \ + && curl -L https://github.com/ronggang/twc-release/raw/master/src.tar.gz \ + | tar -C /opt/transmission-ui/transmission-web-control/ -xzv \ + && apt-get purge git unzip \ + && apt-get autoremove --purge \ + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && curl -L https://github.com/jwilder/dockerize/releases/download/v0.6.0/dockerize-linux-armhf-v0.6.0.tar.gz \ + | tar -C /usr/local/bin -xzv \ + && groupmod -g 1000 users \ + && useradd -u 911 -U -d /config -s /bin/false abc \ + && usermod -G users abc + +# Add configuration and scripts +ADD openvpn/ /etc/openvpn/ +ADD transmission/ /etc/transmission/ +ADD tinyproxy /opt/tinyproxy/ + +ENV OPENVPN_USERNAME=**None** \ + OPENVPN_PASSWORD=**None** \ + OPENVPN_PROVIDER=**None** \ + GLOBAL_APPLY_PERMISSIONS=true \ + TRANSMISSION_ALT_SPEED_DOWN=50 \ + TRANSMISSION_ALT_SPEED_ENABLED=false \ + TRANSMISSION_ALT_SPEED_TIME_BEGIN=540 \ + TRANSMISSION_ALT_SPEED_TIME_DAY=127 \ + TRANSMISSION_ALT_SPEED_TIME_ENABLED=false \ + TRANSMISSION_ALT_SPEED_TIME_END=1020 \ + TRANSMISSION_ALT_SPEED_UP=50 \ + TRANSMISSION_BIND_ADDRESS_IPV4=0.0.0.0 \ + TRANSMISSION_BIND_ADDRESS_IPV6=:: \ + TRANSMISSION_BLOCKLIST_ENABLED=false \ + TRANSMISSION_BLOCKLIST_URL=http://www.example.com/blocklist \ + TRANSMISSION_CACHE_SIZE_MB=4 \ + TRANSMISSION_DHT_ENABLED=true \ + TRANSMISSION_DOWNLOAD_DIR=/data/completed \ + TRANSMISSION_DOWNLOAD_LIMIT=100 \ + TRANSMISSION_DOWNLOAD_LIMIT_ENABLED=0 \ + TRANSMISSION_DOWNLOAD_QUEUE_ENABLED=true \ + TRANSMISSION_DOWNLOAD_QUEUE_SIZE=5 \ + TRANSMISSION_ENCRYPTION=1 \ + TRANSMISSION_IDLE_SEEDING_LIMIT=30 \ + TRANSMISSION_IDLE_SEEDING_LIMIT_ENABLED=false \ + TRANSMISSION_INCOMPLETE_DIR=/data/incomplete \ + TRANSMISSION_INCOMPLETE_DIR_ENABLED=true \ + TRANSMISSION_LPD_ENABLED=false \ + TRANSMISSION_MAX_PEERS_GLOBAL=200 \ + TRANSMISSION_MESSAGE_LEVEL=2 \ + TRANSMISSION_PEER_CONGESTION_ALGORITHM= \ + TRANSMISSION_PEER_ID_TTL_HOURS=6 \ + TRANSMISSION_PEER_LIMIT_GLOBAL=200 \ + TRANSMISSION_PEER_LIMIT_PER_TORRENT=50 \ + TRANSMISSION_PEER_PORT=51413 \ + TRANSMISSION_PEER_PORT_RANDOM_HIGH=65535 \ + TRANSMISSION_PEER_PORT_RANDOM_LOW=49152 \ + TRANSMISSION_PEER_PORT_RANDOM_ON_START=false \ + TRANSMISSION_PEER_SOCKET_TOS=default \ + TRANSMISSION_PEX_ENABLED=true \ + TRANSMISSION_PORT_FORWARDING_ENABLED=false \ + TRANSMISSION_PREALLOCATION=1 \ + TRANSMISSION_PREFETCH_ENABLED=1 \ + TRANSMISSION_QUEUE_STALLED_ENABLED=true \ + TRANSMISSION_QUEUE_STALLED_MINUTES=30 \ + TRANSMISSION_RATIO_LIMIT=2 \ + TRANSMISSION_RATIO_LIMIT_ENABLED=false \ + TRANSMISSION_RENAME_PARTIAL_FILES=true \ + TRANSMISSION_RPC_AUTHENTICATION_REQUIRED=false \ + TRANSMISSION_RPC_BIND_ADDRESS=0.0.0.0 \ + TRANSMISSION_RPC_ENABLED=true \ + TRANSMISSION_RPC_HOST_WHITELIST= \ + TRANSMISSION_RPC_HOST_WHITELIST_ENABLED=false \ + TRANSMISSION_RPC_PASSWORD=password \ + TRANSMISSION_RPC_PORT=9091 \ + TRANSMISSION_RPC_URL=/transmission/ \ + TRANSMISSION_RPC_USERNAME=username \ + TRANSMISSION_RPC_WHITELIST=127.0.0.1 \ + TRANSMISSION_RPC_WHITELIST_ENABLED=false \ + TRANSMISSION_SCRAPE_PAUSED_TORRENTS_ENABLED=true \ + TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED=false \ + TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME= \ + TRANSMISSION_SEED_QUEUE_ENABLED=false \ + TRANSMISSION_SEED_QUEUE_SIZE=10 \ + TRANSMISSION_SPEED_LIMIT_DOWN=100 \ + TRANSMISSION_SPEED_LIMIT_DOWN_ENABLED=false \ + TRANSMISSION_SPEED_LIMIT_UP=100 \ + TRANSMISSION_SPEED_LIMIT_UP_ENABLED=false \ + TRANSMISSION_START_ADDED_TORRENTS=true \ + TRANSMISSION_TRASH_ORIGINAL_TORRENT_FILES=false \ + TRANSMISSION_UMASK=2 \ + TRANSMISSION_UPLOAD_LIMIT=100 \ + TRANSMISSION_UPLOAD_LIMIT_ENABLED=0 \ + TRANSMISSION_UPLOAD_SLOTS_PER_TORRENT=14 \ + TRANSMISSION_UTP_ENABLED=true \ + TRANSMISSION_WATCH_DIR=/data/watch \ + TRANSMISSION_WATCH_DIR_ENABLED=true \ + TRANSMISSION_HOME=/data/transmission-home \ + TRANSMISSION_WATCH_DIR_FORCE_GENERIC=false \ + ENABLE_UFW=false \ + UFW_ALLOW_GW_NET=false \ + UFW_EXTRA_PORTS= \ + UFW_DISABLE_IPTABLES_REJECT=false \ + TRANSMISSION_WEB_UI=\ + PUID=\ + PGID=\ + TRANSMISSION_WEB_HOME= \ + DROP_DEFAULT_ROUTE= \ + WEBPROXY_ENABLED=false \ + WEBPROXY_PORT=8888 + +# Expose port and run +EXPOSE 9091 +CMD ["dumb-init", "/etc/openvpn/start.sh"] + +RUN [ "cross-build-end" ] diff --git a/README.md b/README.md index c1b38f6fe..50931ab92 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ This image was created for my own use, but sharing is caring, so it had to be op It has now gotten quite popular, and that's great! But keeping it up to date, providing support, fixes and new features takes a lot of time. -I'm therefore kindly asking you to donate if you feel like you're getting a good tool +I'm therefore kindly asking you to donate if you feel like you're getting a good tool and you're able to spare some dollars to keep it functioning as it should. There's a couple of ways to do it: Become a patron, supporting the project with a small monthly amount. @@ -205,8 +205,8 @@ This is to prevent leaking the host IP. This container also contains a web-proxy server to allow you to tunnel your web-browser traffic through the same OpenVPN tunnel. This is useful if you are using a private tracker that needs to see you login from the same IP address you are torrenting from. -The default listening port is 8888. Note that only ports above 1024 can be specified as all ports below 1024 are privileged -and would otherwise require root permissions to run. +The default listening port is 8888. Note that only ports above 1024 can be specified as all ports below 1024 are privileged +and would otherwise require root permissions to run. Remember to add a port binding for your selected (or default) port when starting the container. | Variable | Function | Example | @@ -354,10 +354,12 @@ For example, another container may pause or restrict transmission speeds while t ## Running on ARM (Raspberry PI) Since the Raspberry PI runs on an ARM architecture instead of x64, the existing x64 images will not -work properly. To support users that wish to run this container on a Raspberry Pi, there are 2 additional -Dockerfiles created. The Dockerfiles supported by the Raspberry PI are Dockerfile.armhf -- there is +work properly. There are 2 additional Dockerfiles created. The Dockerfiles supported by the Raspberry PI are Dockerfile.armhf -- there is also an example docker-compose-armhf file that shows how you might use Transmission/OpenVPN and the corresponding nginx reverse proxy on an RPI machine. +You can use the `latest-armhf` tag for each images (see docker-compose-armhf.yml) or build your own images using Dockerfile.armhf. + + ## Make it work on Synology NAS Here are the steps to run it on a Synology NAS (Tested on DSM 6) : @@ -397,8 +399,8 @@ nameserver 8.8.8.8 nameserver 8.8.4.4 ``` - Save the file with [escape] + `:wq!` -- Create your docker container with a the following command line: - +- Create your docker container with a the following command line: + # Tested on DSM 6.1.4-15217 Update 1, Docker Package 17.05.0-0349 docker run \ --cap-add=NET_ADMIN \ diff --git a/docker-compose-armhf.yml b/docker-compose-armhf.yml index 3e04f2b01..62fc3219b 100644 --- a/docker-compose-armhf.yml +++ b/docker-compose-armhf.yml @@ -2,10 +2,7 @@ version: '2' services: transmission: - build: - context: . - dockerfile: Dockerfile.armhf - image: haugene/rpi-transmission-openvpn + image: haugene/transmission-openvpn:latest-armhf cap_add: - NET_ADMIN devices: @@ -26,11 +23,9 @@ services: - OPENVPN_PASSWORD=password - OPENVPN_OPTS=--inactive 3600 --ping 10 --ping-exit 60 - LOCAL_NETWORK=192.168.0.0/24 + proxy: - build: - context: ./proxy - dockerfile: Dockerfile.armhf - image: haugene/rpi-transmission-openvpn-proxy + image: haugene/transmission-openvpn-proxy:latest-armhf links: - transmission ports: @@ -39,10 +34,7 @@ services: - /etc/localtime:/etc/localtime:ro rss: - build: - context: ./plugins/rss - dockerfile: Dockerfile.armhf - image: haugene/rpi-transmission-plugin-rss + image: haugene/transmission-rss:latest-armhf links: - transmission environment: diff --git a/plugins/rss/Dockerfile.armhf b/plugins/rss/Dockerfile.armhf index 6717caf3d..152674f61 100644 --- a/plugins/rss/Dockerfile.armhf +++ b/plugins/rss/Dockerfile.armhf @@ -1,8 +1,6 @@ FROM resin/rpi-raspbian:stretch MAINTAINER Kristian Haugene -RUN [ "cross-build-start" ] - # Update packages and install software RUN apt-get update \ && apt-get -y upgrade \ @@ -16,5 +14,3 @@ ENV TRANSMISSION_DOWNLOAD_DIR=/data/completed \ RSS_URL=**None** CMD ["/etc/transmission-rss/start.sh"] - -RUN [ "cross-build-end" ] diff --git a/plugins/rss/DockerfileCrossBuild.armhf b/plugins/rss/DockerfileCrossBuild.armhf new file mode 100644 index 000000000..7c22166b7 --- /dev/null +++ b/plugins/rss/DockerfileCrossBuild.armhf @@ -0,0 +1,22 @@ +# This Dockerfile is for building ARM images on x64 machine like Docker Hub + +FROM resin/rpi-raspbian:stretch +MAINTAINER Kristian Haugene + +RUN [ "cross-build-start" ] + +# Update packages and install software +RUN apt-get update \ + && apt-get -y upgrade \ + && apt-get -y install curl gcc make ruby2.3-dev libc6-dev \ + && gem install transmission-rss \ + && curl -L https://github.com/jwilder/dockerize/releases/download/v0.2.0/dockerize-linux-armhf-v0.2.0.tar.gz | tar -C /usr/local/bin -xzv + +ADD . /etc/transmission-rss + +ENV TRANSMISSION_DOWNLOAD_DIR=/data/completed \ + RSS_URL=**None** + +CMD ["/etc/transmission-rss/start.sh"] + +RUN [ "cross-build-end" ] diff --git a/proxy/Dockerfile.armhf b/proxy/Dockerfile.armhf index 48d4c70cd..9ca81080b 100644 --- a/proxy/Dockerfile.armhf +++ b/proxy/Dockerfile.armhf @@ -1,7 +1,5 @@ FROM resin/rpi-raspbian:stretch -RUN [ "cross-build-start" ] - RUN apt-get update \ && apt-get install -y \ ca-certificates \ @@ -16,5 +14,3 @@ EXPOSE 8080 COPY nginx.conf /etc/nginx/nginx.conf CMD ["nginx", "-g", "daemon off;"] - -RUN [ "cross-build-end" ] diff --git a/proxy/DockerfileCrossBuild.armhf b/proxy/DockerfileCrossBuild.armhf new file mode 100644 index 000000000..de2da1b32 --- /dev/null +++ b/proxy/DockerfileCrossBuild.armhf @@ -0,0 +1,22 @@ +# This Dockerfile is for building ARM images on x64 machine like Docker Hub + +FROM resin/rpi-raspbian:stretch + +RUN [ "cross-build-start" ] + +RUN apt-get update \ + && apt-get install -y \ + ca-certificates \ + nginx \ + && rm -rf /var/lib/apt/lists/* + +RUN ln -sf /dev/stdout /var/log/nginx/access.log \ + && ln -sf /dev/stderr /var/log/nginx/error.log + +EXPOSE 8080 + +COPY nginx.conf /etc/nginx/nginx.conf + +CMD ["nginx", "-g", "daemon off;"] + +RUN [ "cross-build-end" ]