forked from boredazfcuk/docker-icloudpd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
icloudpd.dockerfile
63 lines (56 loc) · 3.62 KB
/
icloudpd.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
FROM alpine:3.18.2
MAINTAINER boredazfcuk
ENV config_dir="/config" TZ="UTC"
ARG icloudpd_version="1.14.5"
ARG python_version="3.11"
ARG build_dependencies="git gcc python3-dev musl-dev rust cargo libffi-dev openssl-dev"
ARG app_dependencies="py3-pip exiftool coreutils tzdata curl imagemagick shadow jq"
ARG fix_repo="boredazfcuk/icloud_photos_downloader"
RUN echo "$(date '+%d/%m/%Y - %H:%M:%S') | ***** Build started for boredazfcuk's docker-icloudpd *****" && \
echo "$(date '+%d/%m/%Y - %H:%M:%S') | Install build dependencies" && \
apk add --no-progress --no-cache --virtual=build-deps ${build_dependencies} && \
echo "$(date '+%d/%m/%Y - %H:%M:%S') | Install requirements" && \
apk add --no-progress --no-cache ${app_dependencies} && \
echo "$(date '+%d/ %m/%Y - %H:%M:%S') | Create and enter icloudpd_v.1.7.2_china virtual environment" && \
python -m venv /opt/icloudpd_v1.7.2_china && \
source /opt/icloudpd_v1.7.2_china/bin/activate && \
echo "$(date '+%d/%m/%Y - %H:%M:%S') | Clone ${fix_repo}" && \
fix_dir=$(mktemp -d) && \
git clone --branch china_auth_fix --depth=1 "https://github.com/${fix_repo}.git" "${fix_dir}" && \
cd "${fix_dir}" && \
sed -i 's/version="1.7.2/version="1.7.2_china_auth_fix/' setup.py && \
echo "$(date '+%d/%m/%Y - %H:%M:%S') | Install Python dependencies for China fix" && \
pip3 install --upgrade pip && \
pip3 install --no-cache-dir -r requirements.txt && \
echo "$(date '+%d/%m/%Y - %H:%M:%S') | Install iCloudPD v1.7.2_china_auth_fix" && \
python3 setup.py install && \
cd .. && \
rm -r "${fix_dir}" && \
sed -i -e 's/icloud.com/icloud.com.cn/g' /opt/icloudpd_v1.7.2_china/lib/python${python_version}/site-packages/pyicloud/base.py && \
sed -i -e 's/apple.com/apple.com.cn/g' /opt/icloudpd_v1.7.2_china/lib/python${python_version}/site-packages/pyicloud/base.py && \
sed -i -e 's/password_encrypted = base64.decodestring(password_base64)/password_encrypted = base64.decodebytes(password_base64)/' \
-e 's/password_base64 = base64.encodestring(password_encrypted).decode()/password_base64 = base64.encodebytes(password_encrypted).decode()/' \
"/opt/icloudpd_v1.7.2_china/lib/python${python_version}/site-packages/keyrings/alt/file_base.py" && \
sed -i 's/again in a few minutes/again later. This process may take a day or two./' \
"/opt/icloudpd_v1.7.2_china/lib/python${python_version}/site-packages/pyicloud/services/photos.py" && \
deactivate && \
echo "$(date '+%d/%m/%Y - %H:%M:%S') | Install iCloudPD latest release" && \
python -m venv /opt/icloudpd_latest && \
source /opt/icloudpd_latest/bin/activate && \
pip3 install --upgrade pip && \
pip3 install --no-cache-dir wheel && \
pip3 install --no-cache-dir icloudpd && \
sed -i -e 's/password_encrypted = base64.decodestring(password_base64)/password_encrypted = base64.decodebytes(password_base64)/' \
-e 's/password_base64 = base64.encodestring(password_encrypted).decode()/password_base64 = base64.encodebytes(password_encrypted).decode()/' \
"/opt/icloudpd_latest/lib/python${python_version}/site-packages/keyrings/alt/file_base.py" && \
sed -i 's/again in a few minutes/again later. This process may take a day or two./' \
"/opt/icloudpd_latest/lib/python${python_version}/site-packages/pyicloud_ipd/services/photos.py" && \
deactivate && \
echo "$(date '+%d/%m/%Y - %H:%M:%S') | Clean up" && \
apk del --no-progress --purge build-deps
COPY build_version.txt /
COPY --chmod=0755 *.sh /usr/local/bin/
COPY CONFIGURATION.md /opt
HEALTHCHECK --start-period=10s --interval=1m --timeout=10s CMD /usr/local/bin/healthcheck.sh
VOLUME "${config_dir}"
CMD /usr/local/bin/sync-icloud.sh