forked from jesec/rtorrent
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
73 lines (54 loc) · 1.83 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
FROM ubuntu:22.04 AS build
ADD --chmod=755 https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 /usr/local/bin/bazel
ENV RTORRENT_VERSION=0.9.8
ENV RTORRENT_REVISION=r17
WORKDIR /root/rtorrent
# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
git \
python-is-python3 \
python3
# Checkout rTorrent sources from current directory
COPY . ./
# # Checkout rTorrent sources from Github repository
# RUN git clone --depth 1 https://github.com/Elegant996/rtorrent .
# Set architecture for packages
RUN sed -i 's/architecture = \"all\"/architecture = \"amd64\"/' BUILD.bazel
# Build rTorrent packages
RUN bazel build rtorrent-deb --features=fully_static_link --verbose_failures
# Copy outputs
RUN mkdir dist
RUN cp -L bazel-bin/rtorrent dist/
RUN cp -L bazel-bin/rtorrent-deb.deb dist/
# Now get the clean image
FROM alpine:3.20 AS build-sysroot
WORKDIR /root
# Fetch runtime dependencies
RUN mkdir -p /sysroot/etc/apk && cp -r /etc/apk/* /sysroot/etc/apk/
RUN apk add --no-cache --initdb -p /sysroot \
alpine-baselayout \
busybox \
ca-certificates \
curl \
jq \
mktorrent \
ncurses-terminfo-base \
tini \
tzdata \
unzip \
&& apk --no-cache upgrade \
-X https://dl-cdn.alpinelinux.org/alpine/v3.14/main \
unrar
RUN rm -rf /sysroot/etc/apk /sysroot/lib/apk /sysroot/var/cache
# Install rTorrent to new system root
RUN mkdir -p /sysroot/etc/rtorrent /sysroot/download /sysroot/session /sysroot/watch
COPY --from=build /root/rtorrent/dist/rtorrent /sysroot/usr/local/bin
COPY doc/rtorrent.rc /sysroot/etc/rtorrent
FROM scratch AS rtorrent
COPY --from=build-sysroot /sysroot /
EXPOSE 5000
STOPSIGNAL SIGHUP
ENV HOME=/download
ENTRYPOINT [ "/sbin/tini", "--" ]
CMD [ "/usr/local/bin/rtorrent" ]