From 1c9c4f09206b24ba0b3ad442ed0e4cc85fb9ead3 Mon Sep 17 00:00:00 2001 From: Mandar Patil Date: Wed, 15 May 2024 06:51:09 -0700 Subject: [PATCH] [Fix] v1.18.1 binary path + login doesn't persist (#207) (#208) * Added /venv/bin to PATH and /app to PYTHONPATH; * Updated docs to specify --user=icd; --- Dockerfile | 2 ++ README.md | 5 ++--- src/notify.py | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3acd9819..b322cd20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,5 +17,7 @@ COPY --from=build /venv /venv RUN apk update && apk add sudo libmagic shadow dumb-init COPY . /app/ WORKDIR /app +ENV PATH="/venv/bin/:$PATH" +ENV PYTHONPATH="/app:${PYTHONPATH}" ENTRYPOINT ["dumb-init", "--"] CMD ["/app/init.sh"] \ No newline at end of file diff --git a/README.md b/README.md index f2c31f13..48aa931f 100644 --- a/README.md +++ b/README.md @@ -52,14 +52,14 @@ services: ``` # Login manually if ENV_ICLOUD_PASSWORD is not specified and/or 2FA is required -docker exec -it icloud /bin/sh -c "icloud --username= --session-directory=/app/session_data" +docker exec -it --user=icd icloud /bin/sh -c "icloud --username= --session-directory=/app/session_data" ``` For China server users, Please add `--region=china` as follows: ``` # Login manually if ENV_ICLOUD_PASSWORD is not specified and/or 2FA is required -docker exec -it icloud /bin/sh -c "icloud --username= --region=china --session-directory=/app/session_data" +docker exec -it --user=icd icloud /bin/sh -c "icloud --username= --region=china --session-directory=/app/session_data" ``` Follow the steps to authenticate. @@ -164,4 +164,3 @@ As mentioned in [USAGE.md](https://github.com/mandarons/icloud-drive-docker/blob [github-sponsors-badge]: https://img.shields.io/github/sponsors/mandarons [discord]: https://discord.gg/33TuzKFE [discord-badge]: https://img.shields.io/discord/871555550444408883 - diff --git a/src/notify.py b/src/notify.py index 0dcc9434..da655c2d 100644 --- a/src/notify.py +++ b/src/notify.py @@ -9,7 +9,7 @@ MESSAGE_BODY = """Two-step authentication for iCloud Drive, Photos (Docker) is required. Please login to your server and authenticate. Please run - - `docker exec -it icloud /bin/sh -c "icloud --username= + `docker exec -it --user=icd icloud /bin/sh -c "icloud --username= --session-directory=/app/session_data"`.""" @@ -137,6 +137,7 @@ def build_message(email, to_email): message.subject = "icloud-docker: Two step authentication required" message.body = """Two-step authentication for iCloud Drive, Photos (Docker) is required. Please login to your server and authenticate. Please run - -`docker exec -it icloud /bin/sh -c "icloud --username= --session-directory=/app/session_data"`.""" +`docker exec -it --user=icd icloud /bin/sh -c "icloud --username= +--session-directory=/app/session_data"`.""" return message