-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed base image to lsio, now properly implements PGID and PUID (#224)
- Loading branch information
Showing
27 changed files
with
125 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"python.testing.pytestArgs": ["tests", "--no-cov"], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true | ||
"python.testing.pytestEnabled": true, | ||
"python.envFile": "${workspaceFolder}/tests/.env" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,52 @@ | ||
FROM python:3.10-alpine3.19 AS build | ||
RUN apk update && apk add git gcc musl-dev python3-dev libffi-dev openssl-dev cargo | ||
COPY requirements.txt . | ||
RUN python -m venv /venv | ||
ENV PATH="/venv/bin/:$PATH" | ||
RUN pip install -U pip | ||
RUN pip install -r requirements.txt | ||
FROM python:3.10-alpine3.19 | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM ghcr.io/linuxserver/baseimage-alpine:3.19 | ||
|
||
# set version label | ||
ARG APP_VERSION=dev | ||
ARG NEW_INSTALLATION_ENDPOINT=dev | ||
ARG NEW_HEARTBEAT_ENDPOINT=dev | ||
ENV NEW_INSTALLATION_ENDPOINT=$NEW_INSTALLATION_ENDPOINT | ||
ENV NEW_HEARTBEAT_ENDPOINT=$NEW_HEARTBEAT_ENDPOINT | ||
ENV APP_VERSION=$APP_VERSION | ||
COPY --from=build /venv /venv | ||
# Libmagic is required at runtime by python-magic | ||
LABEL maintainer="mandarons" | ||
|
||
ENV HOME="/app" | ||
COPY requirements.txt . | ||
RUN \ | ||
echo "**** install build packages ****" && \ | ||
apk add --no-cache --virtual=build-dependencies \ | ||
git \ | ||
gcc \ | ||
musl-dev \ | ||
python3-dev \ | ||
libffi-dev \ | ||
openssl-dev \ | ||
sudo libmagic shadow dumb-init \ | ||
cargo && \ | ||
echo "**** install packages ****" && \ | ||
apk add --no-cache \ | ||
python3 && \ | ||
echo "**** install icloud app ****" && \ | ||
python3 -m venv /lsiopy && \ | ||
pip install -U --no-cache-dir \ | ||
pip \ | ||
wheel && \ | ||
pip install -U --no-cache-dir -r requirements.txt && \ | ||
echo "**** cleanup ****" && \ | ||
apk del --purge \ | ||
build-dependencies && \ | ||
rm -rf \ | ||
/tmp/* \ | ||
${HOME}/.cache \ | ||
${HOME}/.cargo | ||
|
||
# add local files | ||
RUN apk update && apk add sudo libmagic shadow dumb-init | ||
COPY root/ / | ||
COPY . /app/ | ||
WORKDIR /app | ||
ENV PATH="/venv/bin/:$PATH" | ||
ENV PYTHONPATH="/app:${PYTHONPATH}" | ||
ENTRYPOINT ["dumb-init", "--"] | ||
CMD ["/app/init.sh"] | ||
|
||
# ports and volumes | ||
EXPOSE 8000 | ||
VOLUME /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ Primary use case of iCloud-docker is to periodically sync wanted or all of your | |
### Installation using Docker Hub | ||
|
||
``` | ||
docker run --name icloud -v ${PWD}/icloud:/app/icloud -v ${PWD}/config.yaml:/app/config.yaml -e ENV_ICLOUD_PASSWORD=<icloud_password> -v ${PWD}/session_data:/app/session_data mandarons/icloud-drive | ||
docker run --name icloud -v ${PWD}/icloud:/icloud -v ${PWD}/config/config.yaml:/config/config.yaml -e ENV_ICLOUD_PASSWORD=<icloud_password> -v ${PWD}/session_data:/config/session_data mandarons/icloud-drive | ||
``` | ||
|
||
### Installation using docker-compose | ||
|
@@ -36,30 +36,29 @@ services: | |
- PUID=<insert the output of `id -u $user`> | ||
- GUID=<insert the output of `id -g $user`> | ||
env_file: | ||
- .env.icloud #should contain ENV_ICLOUD_PASSWORD=<password>, ENV_CONFIG_FILE_PATH=<absolute path in container to config.yaml> | ||
- .env.icloud #should contain ENV_ICLOUD_PASSWORD=<password> | ||
container_name: icloud | ||
restart: unless-stopped | ||
volumes: | ||
- /etc/timezone:/etc/timezone:ro | ||
- /etc/localtime:/etc/localtime:ro | ||
# To override /app/config.yaml path in container, specify environment variable ENV_CONFIG_FILE_PATH=<absolute path in container to config.yaml> | ||
- ${PWD}/icloud/config.yaml:/app/config.yaml | ||
- ${PWD}/icloud/data:/app/icloud | ||
- ${PWD}/session_data:/app/session_data | ||
- ${PWD}/config/config.yaml:/config/config.yaml | ||
- ${PWD}/icloud:/icloud | ||
- ${PWD}/config/session_data:/config/session_data | ||
``` | ||
### Authentication (required after container creation or authentication expiration) | ||
``` | ||
# Login manually if ENV_ICLOUD_PASSWORD is not specified and/or 2FA is required | ||
docker exec -it --user=icd icloud /bin/sh -c "icloud --username=<icloud-username> --session-directory=/app/session_data" | ||
docker exec -it --user=icd icloud /bin/sh -c "icloud --username=<icloud-username> --session-directory=/config/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 --user=icd icloud /bin/sh -c "icloud --username=<icloud-username> --region=china --session-directory=/app/session_data" | ||
docker exec -it --user=icd icloud /bin/sh -c "icloud --username=<icloud-username> --region=china --session-directory=/config/session_data" | ||
``` | ||
|
||
Follow the steps to authenticate. | ||
|
@@ -72,14 +71,14 @@ app: | |
# level - debug, info (default), warning or error | ||
level: "info" | ||
# log filename icloud.log (default) | ||
filename: "icloud.log" | ||
filename: "/config/icloud.log" | ||
credentials: | ||
# iCloud drive username | ||
username: "[email protected]" | ||
# Retry login interval - default is 10 minutes, specifying -1 will retry login only once and exit | ||
retry_login_interval: 600 | ||
# Drive destination | ||
root: "icloud" | ||
root: "/icloud" | ||
discord: | ||
# webhook_url: <your server webhook URL here> | ||
# username: icloud-docker #or any other name you prefer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,15 @@ app: | |
logger: | ||
# level - debug, info (default), warning or error | ||
level: "info" | ||
# log filename icloud.log (default) | ||
filename: "icloud.log" | ||
# log filename icloud.log | ||
filename: "/config/icloud.log" | ||
credentials: | ||
# iCloud drive username | ||
username: "[email protected]" | ||
# Retry login interval - default is 10 minutes | ||
retry_login_interval: 600 | ||
# Drive destination | ||
root: "icloud" | ||
root: "/icloud" | ||
discord: | ||
# webhook_url: <your server webhook URL here> | ||
# username: icloud-docker #or any other name you prefer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#!/bin/sh | ||
echo ' | ||
==================================================== | ||
To support this project, please consider sponsoring. | ||
https://github.com/sponsors/mandarons | ||
https://www.buymeacoffee.com/mandarons | ||
==================================================== | ||
' | ||
|
||
cd /app && export PYTHONPATH=/app && export PATH=/venv/bin:$PATH && python ./src/main.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/with-contenv bash | ||
# shellcheck shell=bash | ||
|
||
PUID=${PUID:-911} | ||
PGID=${PGID:-911} | ||
|
||
groupmod -o -g "$PGID" abc | ||
usermod -o -u "$PUID" abc | ||
|
||
echo " | ||
==================================================== | ||
To support this project, please consider sponsoring. | ||
https://github.com/sponsors/mandarons | ||
https://www.buymeacoffee.com/mandarons | ||
|
||
User UID: $(id -u abc) | ||
User GID: $(id -g abc) | ||
==================================================== | ||
" | ||
|
||
|
||
if [[ -f /build_version ]]; then | ||
cat /build_version | ||
fi | ||
|
||
|
||
lsiown abc:abc /app | ||
lsiown abc:abc /config | ||
lsiown abc:abc /defaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/s6-rc.d/init-adduser/run |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/with-contenv bash | ||
# shellcheck shell=bash | ||
|
||
# create our folders | ||
mkdir -p \ | ||
/icloud \ | ||
/config/session | ||
|
||
# # default config file | ||
# cp -n \ | ||
# /defaults/pyload.cfg \ | ||
# /config/settings/pyload.cfg | ||
|
||
# permissions | ||
lsiown -R abc:abc \ | ||
/app \ | ||
/config | ||
lsiown abc:abc \ | ||
/icloud |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/s6-rc.d/init-icd-config/run |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/with-contenv bash | ||
# shellcheck shell=bash | ||
|
||
|
||
exec \ | ||
s6-setuidgid abc /app/init.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
longrun |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters