forked from pyload/pyload
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.armhf
116 lines (86 loc) · 3.85 KB
/
Dockerfile.armhf
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Highly-Optimized Docker Image of pyLoad (ubuntu-arm32v7 variant)
# ____________
# ___/ | \_____________ _ _ ___
# / ___/ | _ __ _ _| | ___ __ _ __| | \
# / \___/ ______/ | '_ \ || | |__/ _ \/ _` / _` | \
# \ ◯ | | .__/\_, |____\___/\__,_\__,_| /
# \_______\ /_______|_| |__/________________________/
# \ /
# \/
ARG IMAGE_TAG="arm32v7-bionic"
ARG IMAGE_CREATED
ARG IMAGE_AUTHORS="Walter Purcaro <vuolter@gmail.com>"
ARG IMAGE_URL="https://github.com/pyload/pyload"
ARG IMAGE_DOCUMENTATION="https://github.com/pyload/pyload/blob/main/README.md"
ARG IMAGE_SOURCE="https://github.com/pyload/pyload/blob/main/Dockerfile.armhf"
ARG IMAGE_VERSION="2.0.0"
ARG IMAGE_REVISION
ARG IMAGE_VENDOR="pyload"
ARG IMAGE_LICENSES="ISC"
ARG IMAGE_TITLE="pyLoad"
ARG IMAGE_DESCRIPTION="The free and open-source Download Manager written in pure Python"
ARG APT_INSTALL_OPTIONS="--no-install-recommends --assume-yes"
ARG PIP_INSTALL_OPTIONS="--disable-pip-version-check --no-cache-dir --no-compile --upgrade"
FROM lsiobase/ubuntu:$IMAGE_TAG AS builder
ARG APT_PACKAGES="python3 python3-distutils python3-pip python3-pycurl openssl sqlite tesseract-ocr unrar"
ARG PIP_PACKAGES="pip setuptools wheel"
RUN echo "**** install binary packages ****" && \
apt-get update && \
apt-get install $APT_INSTALL_OPTIONS $APT_PACKAGES && \
\
echo "**** install pip package ****" && \
pip3 install $PIP_INSTALL_OPTIONS $PIP_PACKAGES
FROM builder AS wheels_builder
COPY setup.cfg /source/setup.cfg
WORKDIR /wheels
RUN echo "**** build pyLoad dependencies ****" && \
python3 -c "import configparser as cp; c = cp.ConfigParser(); c.read('/source/setup.cfg'); print(c['options']['install_requires'] + c['options.extras_require']['extra'])" | \
xargs pip3 wheel --wheel-dir=.
FROM builder AS source_builder
ARG PIP_PACKAGES="Babel Jinja2"
COPY . /source
WORKDIR /source
RUN echo "**** build pyLoad locales ****" && \
pip3 install $PIP_INSTALL_OPTIONS $PIP_PACKAGES && \
python3 setup.py build_locale
FROM builder AS package_builder
COPY --from=wheels_builder /wheels /wheels
COPY --from=source_builder /source /source
WORKDIR /package
RUN echo "**** build pyLoad package ****" && \
pip3 install $PIP_INSTALL_OPTIONS --find-links=/wheels --no-index --prefix=. /source[extra]
FROM builder
# Set Python to force stdin, stdout and stderr to be totally unbuffered.
ENV PYTHONUNBUFFERED="1"
# Stop if any script (fix-attrs or cont-init) has failed.
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS="2"
ARG TEMPDIR="/root/.cache /tmp/* /var/lib/apt/lists/* /var/tmp/*"
RUN echo "**** create s6 fix-attr script ****" && \
echo -e "/config true abc 0644 0755\n \
/downloads false abc 0644 0755" > /etc/fix-attrs.d/10-run && \
\
echo "**** create s6 service script ****" && \
mkdir -p /etc/services.d/pyload && \
echo -e "#!/usr/bin/with-contenv bash\n\n \
umask 022\n \
exec s6-setuidgid abc pyload --userdir /config --storagedir /downloads" > /etc/services.d/pyload/run && \
\
echo "**** cleanup ****" && \
apt-get clean && \
rm -rf $TEMPDIR && \
\
echo "**** finalize ****"
COPY --from=package_builder /package /usr/local
EXPOSE 8000 9666
VOLUME /config /downloads
LABEL org.opencontainers.image.created=$IMAGE_CREATED
LABEL org.opencontainers.image.authors=$IMAGE_AUTHORS
LABEL org.opencontainers.image.url=$IMAGE_URL
LABEL org.opencontainers.image.documentation=$IMAGE_DOCUMENTATION
LABEL org.opencontainers.image.source=$IMAGE_SOURCE
LABEL org.opencontainers.image.version=$IMAGE_VERSION
LABEL org.opencontainers.image.revision=$IMAGE_REVISION
LABEL org.opencontainers.image.vendor=$IMAGE_VENDOR
LABEL org.opencontainers.image.licenses=$IMAGE_LICENSES
LABEL org.opencontainers.image.title=$IMAGE_TITLE
LABEL org.opencontainers.image.description=$IMAGE_DESCRIPTION