Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

separate linux glibc and musl binaries. deprecate linux 386 & arm/v6 #919

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
e0440fd
add builder with cache
AndreyNikiforov Jul 14, 2024
374e858
full platform spec in docker build
AndreyNikiforov Jul 14, 2024
0e0f50c
use scripts for apt install
AndreyNikiforov Jul 14, 2024
506985d
limit to amd64
AndreyNikiforov Jul 14, 2024
90a2773
hard code values
AndreyNikiforov Jul 14, 2024
537cdd9
update exec flags
AndreyNikiforov Jul 14, 2024
4be9e6c
add lic & readme
AndreyNikiforov Jul 14, 2024
23b28cc
use vars and cargo cache
AndreyNikiforov Jul 14, 2024
0aea9fb
try all platforms
AndreyNikiforov Jul 14, 2024
74a3169
root output
AndreyNikiforov Jul 14, 2024
2890354
experiment with workdir
AndreyNikiforov Jul 14, 2024
4259cfb
use gha cache directly from docker
AndreyNikiforov Jul 14, 2024
56583c2
add gh token to cache
AndreyNikiforov Jul 14, 2024
38cc10a
tweak logging
AndreyNikiforov Jul 14, 2024
e32a881
update setup buildx
AndreyNikiforov Jul 14, 2024
a607a5d
use staticx from pypi
AndreyNikiforov Jul 14, 2024
5bedd8d
host 22.04->24.04
AndreyNikiforov Jul 14, 2024
186f7ae
remove rust for amd64
AndreyNikiforov Jul 15, 2024
68e3241
bump scons 4.6 -> 4.8
AndreyNikiforov Jul 15, 2024
0de4ea3
use docker build action
AndreyNikiforov Jul 15, 2024
00dd49a
fix syntax
AndreyNikiforov Jul 15, 2024
e48213a
syntax
AndreyNikiforov Jul 15, 2024
6dfd4c3
synt
AndreyNikiforov Jul 15, 2024
6810c69
add arm64
AndreyNikiforov Jul 15, 2024
11fb209
use staticx from pip and no rust
AndreyNikiforov Jul 15, 2024
0fe0c28
restore rus for all but amd64 & arm64
AndreyNikiforov Jul 15, 2024
2de0844
try all platforms
AndreyNikiforov Jul 15, 2024
1de4e4b
add qemu
AndreyNikiforov Jul 15, 2024
faf586e
more src around
AndreyNikiforov Jul 16, 2024
3e3dd7e
refactor ver & plat out of docker.build & scripts
AndreyNikiforov Jul 16, 2024
004455c
avoid rust
AndreyNikiforov Jul 16, 2024
3baf829
avoid apt
AndreyNikiforov Jul 16, 2024
be47d72
downgrade host os
AndreyNikiforov Jul 16, 2024
b29a234
sep crypto instal
AndreyNikiforov Jul 16, 2024
b3ddac5
try ubuntu 20.04
AndreyNikiforov Jul 16, 2024
bae6147
dont build rust
AndreyNikiforov Jul 16, 2024
8b65aaa
add old plats
AndreyNikiforov Jul 16, 2024
afc4af4
just keep three latest plats
AndreyNikiforov Jul 16, 2024
3bd80f0
use air gap rust distrib
AndreyNikiforov Jul 17, 2024
d10e5cf
allow reorg to fail
AndreyNikiforov Jul 17, 2024
e6f14f9
add 386
AndreyNikiforov Jul 17, 2024
cce6d9d
fix rust distro names
AndreyNikiforov Jul 17, 2024
3d0a95c
reduce wget logging
AndreyNikiforov Jul 17, 2024
5df8aaa
fix dir checks
AndreyNikiforov Jul 17, 2024
c27b0f5
remove unextract rust from cache
AndreyNikiforov Jul 17, 2024
4731738
reduce tar verbosity
AndreyNikiforov Jul 17, 2024
2843c3d
add arm v6
AndreyNikiforov Jul 17, 2024
624ed8b
bump ubuntu 20->22
AndreyNikiforov Jul 17, 2024
501960c
pyinst without pip cache mount
AndreyNikiforov Jul 17, 2024
d59c376
add venv use
AndreyNikiforov Jul 17, 2024
eec7bc2
remove editable install
AndreyNikiforov Jul 17, 2024
d26a5ce
add musl
AndreyNikiforov Jul 17, 2024
be1620c
build platforms in parallel
AndreyNikiforov Jul 17, 2024
37d7bf2
remove musl missing plats
AndreyNikiforov Jul 17, 2024
b6f8569
remove apt lib caching
AndreyNikiforov Jul 18, 2024
629c338
do pre-build
AndreyNikiforov Jul 18, 2024
bd215e6
add dummy content for pre-build
AndreyNikiforov Jul 18, 2024
891a908
locked mode for pre-built
AndreyNikiforov Jul 18, 2024
9dc0c71
use private and locked for pre-built
AndreyNikiforov Jul 18, 2024
3221495
add -print
AndreyNikiforov Jul 18, 2024
8d4d0de
output newly generated whl
AndreyNikiforov Jul 18, 2024
b24b6c9
fix mkdir
AndreyNikiforov Jul 18, 2024
05de62a
fix copy
AndreyNikiforov Jul 18, 2024
8e8a5b6
add apt
AndreyNikiforov Jul 18, 2024
2915938
staticx after the rest
AndreyNikiforov Jul 18, 2024
5ba066c
fix syntax
AndreyNikiforov Jul 18, 2024
fbb1b64
fix wheels folder name
AndreyNikiforov Jul 18, 2024
1577858
debugging
AndreyNikiforov Jul 18, 2024
e6e2646
more debugging for find
AndreyNikiforov Jul 18, 2024
188f97c
fix cache handling
AndreyNikiforov Jul 18, 2024
7cb5272
use gha cache directly
AndreyNikiforov Jul 18, 2024
f3a92cf
use local cache in build
AndreyNikiforov Jul 18, 2024
e49ff63
remove explicit caching of pre-build whl
AndreyNikiforov Jul 18, 2024
ef7156d
bump cache action 3->4
AndreyNikiforov Jul 18, 2024
c1633c8
add cache debugging logs
AndreyNikiforov Jul 18, 2024
f00621b
fix app dist location
AndreyNikiforov Jul 18, 2024
f0d0bbc
don't use cache for docker action
AndreyNikiforov Jul 18, 2024
d94572e
use explicit folder map
AndreyNikiforov Jul 18, 2024
9c6bbd1
buildx local cache with protection over growth
AndreyNikiforov Jul 19, 2024
d4b5ac0
fix syntax
AndreyNikiforov Jul 19, 2024
5af01b6
remove platform cache ids
AndreyNikiforov Jul 19, 2024
4a1dee3
use toml for cache key
AndreyNikiforov Jul 19, 2024
16ec767
Revert "remove platform cache ids"
AndreyNikiforov Jul 19, 2024
5579d38
use build
AndreyNikiforov Jul 19, 2024
fc0edc7
enable musl
AndreyNikiforov Jul 19, 2024
599209e
Reapply "remove platform cache ids"
AndreyNikiforov Jul 19, 2024
e705830
add file renaming
AndreyNikiforov Jul 19, 2024
e38bfea
use sha for cache key
AndreyNikiforov Jul 19, 2024
3b69b64
Revert "use sha for cache key"
AndreyNikiforov Jul 19, 2024
445112c
remove -e in pip install
AndreyNikiforov Jul 19, 2024
d430a43
don't use docker layer cache, but cache folders from outside
AndreyNikiforov Jul 19, 2024
44cf4f3
downgrade cache action 4->3
AndreyNikiforov Jul 19, 2024
f8b1110
use dockerfile as part of the cache key hash
AndreyNikiforov Jul 19, 2024
6353917
downgrade cache dance 3->2
AndreyNikiforov Jul 19, 2024
1c19f21
use docker cmd
AndreyNikiforov Jul 19, 2024
95f4807
use own docker cache
AndreyNikiforov Jul 20, 2024
b3a1f9c
add cache size debugging
AndreyNikiforov Jul 20, 2024
423ffb2
remove trailing slash
AndreyNikiforov Jul 20, 2024
124a75a
remove cache id
AndreyNikiforov Jul 20, 2024
dab1766
limit to amd64
AndreyNikiforov Jul 20, 2024
b401dfd
try dummy img
AndreyNikiforov Jul 20, 2024
19c36d9
replace .cache
AndreyNikiforov Jul 20, 2024
8464087
revert to .cache
AndreyNikiforov Jul 20, 2024
1b1cced
fix json
AndreyNikiforov Jul 20, 2024
7f2a1d4
dummy -> build
AndreyNikiforov Jul 20, 2024
77f92e5
add plats back
AndreyNikiforov Jul 20, 2024
9aa06f9
sharing locked->shared
AndreyNikiforov Jul 20, 2024
4a76bdc
fix restore key
AndreyNikiforov Jul 20, 2024
8206c81
list pip cache before install
AndreyNikiforov Jul 20, 2024
9264ce0
enable qemu
AndreyNikiforov Jul 20, 2024
9de4f9e
enable musl
AndreyNikiforov Jul 20, 2024
943925a
add compat
AndreyNikiforov Jul 20, 2024
8bf525b
disable glibc
AndreyNikiforov Jul 20, 2024
1b58825
add compat to musl
AndreyNikiforov Jul 20, 2024
fc4af4b
fix reorg musl
AndreyNikiforov Jul 20, 2024
0ebcfc0
fix compat
AndreyNikiforov Jul 20, 2024
7d740b8
fix compat platform
AndreyNikiforov Jul 20, 2024
47ea9d2
disable static for musl
AndreyNikiforov Jul 20, 2024
d45910d
fix musl reorg
AndreyNikiforov Jul 20, 2024
1266862
add apk to tzlc musl
AndreyNikiforov Jul 20, 2024
6b6a468
enable glibc amd64 (control)
AndreyNikiforov Jul 20, 2024
a81c53d
add musl tzlc to glibc
AndreyNikiforov Jul 20, 2024
c3aa9a4
fix musl pkg
AndreyNikiforov Jul 20, 2024
d1742bc
fix compat platform
AndreyNikiforov Jul 20, 2024
21509f6
use apk cargo
AndreyNikiforov Jul 20, 2024
621e30f
enable all musl plats
AndreyNikiforov Jul 20, 2024
8ec3b9e
remove musl staticx
AndreyNikiforov Jul 20, 2024
0e3bc83
note
AndreyNikiforov Jul 21, 2024
49ca1fd
add musl to main build and switch docker
AndreyNikiforov Jul 21, 2024
e42adab
disable builds in quick check
AndreyNikiforov Jul 21, 2024
aac76a1
add names to new build jobs
AndreyNikiforov Jul 21, 2024
a0b9a05
tweak AS syntax
AndreyNikiforov Jul 21, 2024
6d6dd42
fix icloudpd-ex name
AndreyNikiforov Jul 21, 2024
3c8fb04
add debug into cloning script
AndreyNikiforov Jul 21, 2024
8fe0c7c
set qemu_cpu for armv6
AndreyNikiforov Jul 21, 2024
eeeeae4
add qemu to musl builder
AndreyNikiforov Jul 21, 2024
7ec01ea
add synology CPUs
AndreyNikiforov Jul 21, 2024
89b620f
fix doc lexer
AndreyNikiforov Jul 21, 2024
5e7f1cc
remove arm32v6 support
AndreyNikiforov Jul 21, 2024
eba7d07
remove 386 support
AndreyNikiforov Jul 21, 2024
22df54d
remove arm32v5
AndreyNikiforov Jul 21, 2024
671a8e1
fix version-info for new builds
AndreyNikiforov Jul 21, 2024
c96560a
add compat for musl bins
AndreyNikiforov Jul 21, 2024
d212dd0
cat tzlc results at test
AndreyNikiforov Jul 21, 2024
24c20fc
add debug version patching in linux build
AndreyNikiforov Jul 21, 2024
0c8aa49
more version debugging
AndreyNikiforov Jul 21, 2024
5dcf4ef
use path context for builds
AndreyNikiforov Jul 21, 2024
26e147a
remove ver info debug
AndreyNikiforov Jul 21, 2024
917f4a6
remove cache debugging
AndreyNikiforov Jul 21, 2024
01cdfb4
minor doc tweak for synology
AndreyNikiforov Jul 21, 2024
499e25a
clean up
AndreyNikiforov Jul 22, 2024
3ef3832
update contrib doc
AndreyNikiforov Jul 22, 2024
31ad5ab
separate tzlc expectations for glibc & musl
AndreyNikiforov Jul 22, 2024
131de09
fix syntax
AndreyNikiforov Jul 22, 2024
e317aef
fix expected tzlc musl
AndreyNikiforov Jul 22, 2024
68a13f2
try apt cargo
AndreyNikiforov Jul 22, 2024
d26551d
remove separate rust from apt cache
AndreyNikiforov Jul 22, 2024
c5f75d0
cache cargo registry
AndreyNikiforov Jul 22, 2024
95f61cd
use tmpfs for cargo
AndreyNikiforov Jul 22, 2024
bfc711c
back to using downloaded rust plust cargo registry cache
AndreyNikiforov Jul 22, 2024
1e5d3d5
remove rust distro caching from musl
AndreyNikiforov Jul 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
925 changes: 587 additions & 338 deletions .github/workflows/build-package.yml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ jobs:
run: |
npm publish dist/npm/@icloudpd/linux-arm --access public
npm publish dist/npm/@icloudpd/linux-arm64 --access public
npm publish dist/npm/@icloudpd/linux-ia32 --access public
npm publish dist/npm/@icloudpd/linux-x64 --access public
npm publish dist/npm/@icloudpd/win32-x64 --access public
npm publish dist/npm/@icloudpd/darwin-x64 --access public
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/quality-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install Test dependencies
run: |
pip3 install --disable-pip-version-check -e .[test]
pip3 install --disable-pip-version-check .[test]

- name: Lint
run: |
Expand All @@ -64,7 +64,7 @@ jobs:
cache: 'pip'
- name: Install Test dependencies
run: |
pip3 install --disable-pip-version-check -e .[test]
pip3 install --disable-pip-version-check .[test]
- name: Type Check
run: |
scripts/type_check
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:

- name: Install Test dependencies
run: |
pip3 install --disable-pip-version-check -e .[test]
pip3 install --disable-pip-version-check .[test]

- name: Test
run: |
Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:

- name: Install Test dependencies
run: |
pip3 install --disable-pip-version-check -e .[test]
pip3 install --disable-pip-version-check .[test]

- name: Test
run: |
Expand All @@ -161,7 +161,7 @@ jobs:
- name: Retrieve version
id: get_version
run: |
echo icloudpd_version=$(cat pyproject.toml | grep version= | cut -d'"' -f 2) >> $GITHUB_OUTPUT
echo icloudpd_version=$(scripts/get_version) >> $GITHUB_OUTPUT

- name: Log version
run: |
Expand All @@ -177,3 +177,4 @@ jobs:
with:
icloudpd_version: ${{needs.get_version.outputs.icloudpd_version}}


35 changes: 28 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ scripts/test

### Building packages

Building Python wheel (with python files):
Building Python wheel (with python source files):

``` sh
scripts/build
Expand All @@ -121,16 +121,26 @@ scripts/build
Building platform executables:

``` sh
scripts/build_bin_linux 1.22.0 amd64
scripts/build_bin2 icloudpd icloud
scripts/build_bin1 icloud
scripts/build_bin1 icloudpd_ex
```
Note: that command is for Linux, including devcontainers. Windows & macOS scripts must be executed on respective platforms.

Building Python wheels (with single executables; platform-specific):
Building Linux static executables:

``` sh
scripts/build_binary_dist_linux 1.22.0
scripts/build_static icloudpd
scripts/build_static icloud
scripts/build_static icloudpd_ex
```
Note: that the step expects executables to be already prepared by previous step

Building Python wheels (with executable):

``` sh
scripts/build_whl
```
Note: that the step expects executables to be already prepared by previous steps

Building NPM packages (with single executables; platform-specific):

Expand All @@ -139,12 +149,23 @@ scripts/build_npm 1.22.0
```
Note: that the step expects executables to be already prepared by previous steps

### Building the Docker image
### Building packages (alternative for Linux)

``` sh
docker buildx create --use --driver=docker-container --name container --bootstrap
docker buildx build . --cache-to type=local,dest=.cache,mode=max --cache-from type=local,src=.cache --platform=linux/amd64 --builder=container --progress plain -o dist -f Dockerfile.build
```

Note: command will produce binaries and .whl for selected platform in dist folder

For `musl` binaries, use `Dockerfile.build-musl`

### Building the Docker

``` sh
docker build -t icloudpd_dev_ .
```
Note: If you work with devcontainers, you most likely need to run that command on the host system inside your source folder.
Note: command packs existing musl binaries from dist folder

### Developing Documentation

Expand Down
31 changes: 11 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
FROM ubuntu:24.04 as runtime_amd64_none
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y tzdata locales-all
WORKDIR /app
COPY dist/icloudpd-ex-*.*.*-linux-amd64 icloudpd_ex

# focal is the last ubuntu for 386
FROM i386/ubuntu:focal as runtime_386_none
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y tzdata locales-all
WORKDIR /app
COPY dist/icloudpd-ex-*.*.*-linux-386 icloudpd_ex

FROM ubuntu:24.04 as runtime_arm64_none
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y tzdata locales-all
FROM alpine:3.18 AS runtime_amd64_none
ENV MUSL_LOCPATH="/usr/share/i18n/locales/musl"
RUN apk update && apk add --no-cache tzdata musl-locales musl-locales-lang
WORKDIR /app
COPY dist/icloudpd-ex-*.*.*-linux-arm64 icloudpd_ex
COPY dist/icloudpd-ex-*.*.*-linux-musl-amd64 icloudpd_ex

FROM ubuntu:24.04 as runtime_arm_v7
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y tzdata locales-all
FROM alpine:3.18 AS runtime_arm64_none
ENV MUSL_LOCPATH="/usr/share/i18n/locales/musl"
RUN apk update && apk add --no-cache tzdata musl-locales musl-locales-lang
WORKDIR /app
COPY dist/icloudpd-ex-*.*.*-linux-arm32v7 icloudpd_ex
COPY dist/icloudpd-ex-*.*.*-linux-musl-arm64 icloudpd_ex

FROM alpine:3.18 as runtime_arm_v6
FROM alpine:3.18 AS runtime_arm_v7
ENV MUSL_LOCPATH="/usr/share/i18n/locales/musl"
RUN apk update && apk add --no-cache tzdata musl-locales musl-locales-lang
WORKDIR /app
COPY dist/icloudpd-ex-*.*.*-linux-arm32v6 icloudpd_ex
COPY dist/icloudpd-ex-*.*.*-linux-musl-arm32v7 icloudpd_ex

FROM runtime_${TARGETARCH}_${TARGETVARIANT:-none} as runtime
FROM runtime_${TARGETARCH}_${TARGETVARIANT:-none} AS runtime
ENV TZ=UTC
EXPOSE 8080
WORKDIR /app
Expand Down
80 changes: 80 additions & 0 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Multi-arch build (local):
# docker buildx create --use --driver=docker-container --name container --bootstrap
# docker buildx build . --cache-to type=local,dest=.cache,mode=max --cache-from type=local,src=.cache --platform=linux/amd64 --builder=container --progress plain -o dist -f Dockerfile.build
# ,linux/arm64,linux/arm/v7
# rust links from https://forge.rust-lang.org/infra/other-installation-methods.html#standalone-installers
# arm7l instead of v6 issue: https://stackoverflow.com/questions/78535054/how-do-you-docker-buildx-build-for-arm-v6-on-qemu-emulated-platforms-that-pres

# map source image to base
FROM python:3.12 AS base
ARG TARGETARCH
ARG TARGETVARIANT
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /app
RUN \
--mount=type=cache,target=/var/cache/apt,sharing=shared \
--mount=type=cache,target=/var/lib/apt,sharing=shared \
rm -f /etc/apt/apt.conf.d/docker-clean && \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache && \
apt-get update && \
apt-get install -y patchelf musl-tools

FROM base AS base_amd64_none
# does not need rustc

FROM base AS base_arm64_none
# does not need rustc

FROM base AS base_arm_v7
# rust from apt is 1.63.0, but min required for cryptography is 1.65.0, so we have to install rust outside of apt
# use downloading of prepackaged rust and caching it seems to provide better experience than recommended rustup
ARG TARGETARCH
ARG TARGETVARIANT
ENV RUST_DISTRO_NAME=rust-1.79.0-armv7-unknown-linux-gnueabihf
RUN \
--mount=type=cache,target=/root/.distrib/rust,sharing=shared \
(if [ ! -d "/root/.distrib/rust/${RUST_DISTRO_NAME}" ]; then \
(wget --no-verbose --no-clobber https://static.rust-lang.org/dist/${RUST_DISTRO_NAME}.tar.xz && \
tar -xf ${RUST_DISTRO_NAME}.tar.xz -C /root/.distrib/rust/); fi) && \
/root/.distrib/rust/${RUST_DISTRO_NAME}/install.sh

FROM base_${TARGETARCH}_${TARGETVARIANT:-none} AS builder
ARG TARGETARCH
ARG TARGETVARIANT
WORKDIR /app
COPY LICENSE.md .
COPY README_PYPI.md .
COPY scripts scripts/
COPY binary_dist binary_dist/
COPY pyproject.toml .
COPY src src/
# staticx must be installed after scons - they do not have deps that pip can handle
# building on arm32v7 cause error in rust from apt (1.63.0): https://github.com/rust-lang/cargo/issues/8719
# workaround is to have /root/.cargo in tmpfs https://github.com/crazy-max/ghaction-docker-buildx/issues/172
# https://github.com/rust-lang/cargo/issues/9545#issuecomment-855282576
# https://github.com/rust-lang/cargo/issues/8719#issuecomment-1207488994
# caching registry as a wa https://stackoverflow.com/a/60590697
#--mount=type=cache,target=/root/.cargo/registry,sharing=shared \
RUN \
--mount=type=cache,target=/root/.cache/pip,sharing=shared \
--mount=type=cache,target=/root/.cargo/registry,sharing=shared \
python3 -m venv .venv && \
. .venv/bin/activate && \
echo "List pip cache..." && \
pip3 cache list && \
pip3 install --disable-pip-version-check .[dev,devlinux] && \
BOOTLOADER_CC=musl-gcc pip3 install --disable-pip-version-check staticx==0.14.1
RUN \
. .venv/bin/activate && \
echo "Building binaries..." && \
scripts/build_bin2 icloudpd icloud && \
scripts/build_bin1 icloud && \
scripts/build_bin1 icloudpd_ex && \
scripts/build_static icloudpd && \
scripts/build_static icloud && \
scripts/build_static icloudpd_ex && \
scripts/build_whl

FROM scratch
WORKDIR /
COPY --from=builder /app/dist/icloud* .
56 changes: 56 additions & 0 deletions Dockerfile.build-musl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Multi-arch build (local):
# docker buildx create --use --driver=docker-container --name container --bootstrap
# docker buildx build . --cache-to type=local,dest=.cache,mode=max --cache-from type=local,src=.cache --platform=linux/amd64 --builder=container --progress plain -o dist -f Dockerfile.build-musl
# ,linux/arm64,linux/arm/v7
# rust links from https://forge.rust-lang.org/infra/other-installation-methods.html#standalone-installers

# map source image to base
FROM python:3.12-alpine3.18 AS base
ARG TARGETARCH
ARG TARGETVARIANT
WORKDIR /app
RUN \
--mount=type=cache,target=/var/cache/apk,sharing=shared \
apk update && \
apk add git curl binutils gcc libc-dev libffi-dev zlib-dev openssl-dev tzdata bash patchelf python3-dev musl-dev pkgconfig cargo
# from https://cryptography.io/en/latest/installation/#building-cryptography-on-linux
# If you get an error with openssl-dev you may have to use libressl-dev.
# cargo

FROM base AS base_amd64_none
# does not need rustc

FROM base AS base_arm64_none
# does not need rustc

FROM base AS base_arm_v7
# does not have musl variant prepackaged but the one from apk works

FROM base_${TARGETARCH}_${TARGETVARIANT:-none} AS builder
ARG TARGETARCH
ARG TARGETVARIANT
ARG QEMU_CPU
WORKDIR /app
COPY LICENSE.md .
COPY README_PYPI.md .
COPY scripts scripts/
COPY binary_dist binary_dist/
COPY pyproject.toml .
COPY src src/
# staticx must be installed after scons
# staticx gives error: Error relocating /tmp/staticx-pyi-9b5nvfi_/_cffi_backend.cpython-312-x86_64-linux-musl.so: PyNumber_Long: symbol not found, so not using for musl
RUN \
--mount=type=cache,target=/root/.cache/pip,sharing=shared \
python3 -m venv .venv && \
. .venv/bin/activate && \
pip3 install --disable-pip-version-check .[dev,devlinux]
RUN \
. .venv/bin/activate && \
scripts/build_bin2 icloudpd icloud && \
scripts/build_bin1 icloud && \
scripts/build_bin1 icloudpd_ex && \
scripts/build_whl

FROM scratch
WORKDIR /
COPY --from=builder /app/dist/icloud* .
2 changes: 1 addition & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Here are the steps to make it working:

When you run the script for the first time, you might see an error message like this:

``` plain
```
Bad Request (400)
```

Expand Down
25 changes: 25 additions & 0 deletions docs/nas.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,28 @@ Once the app has started, connect to the [WebUI](webui) to enter password and MF
## Running on Synology NAS

The error `Failed to execv() /tmp/staticx-kJmNbp` has a workaround by (from an SSH terminal in my case) running `sudo mount /tmp -o remount,exec`. [#788](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/788)

CPU/Arch [used](https://kb.synology.com/en-me/DSM/tutorial/What_kind_of_CPU_does_my_NAS_have) other than amd64 (pre x15):
| CPU | Arch | Models |
|-------|-------|------|
Realtek RTD1619B | arm64 | DS124, DS423, DS223j, DS223
Realtek RTD1296 | arm64 | DS220j, RS819, DS418, DS218, DS218play, DS118
Realtek RTD1293 | arm64 | DS418j
Marvell A3720 | arm64 | DS120j, DS119j
Marvell Armada 385 88F6820 | arm32v7 | DS419slim, DS218j, RS217, RS816, DS416slim, DS216, DS216j, DS116
Annapurna Labs Alpine AL-314 | arm32v7 | DS1817, DS1517
Annapurna Labs Alpine AL-212 | arm32v7 | DS416
Marvell Armada 388 88F6828 | arm32v7 | DS416j
STM STiH412 | arm32v7 | DS216play
Marvell Armada 370 88F6707 | arm32v7 | DS216se

Sample from x15 and before:
| CPU | Arch | Models |
|-------|-------|------|
Marvell Armada XP MV78230 | arm32v7 | RS815
Annapurna Labs Alpine AL-514 | arm32v7 | DS2015xs
Annapurna Labs Alpine AL-314 | arm32v7 | DS1515
Freescale P1022 | power | DS413
Marvell Kirkwood 88F6282 | arm32v5 | DS413j, DS213

[info on Marvel](https://www.kernel.org/doc/html/v6.1/arm/marvell.html)
3 changes: 0 additions & 3 deletions npm/@icloudpd/linux-ia32/README.md

This file was deleted.

20 changes: 0 additions & 20 deletions npm/@icloudpd/linux-ia32/package.json

This file was deleted.

4 changes: 0 additions & 4 deletions npm/icloudpd/bin/icloudpd.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ var knownPlatforms = {
"pkgName": "@icloudpd/linux-x64",
"subPath": "bin/icloudpd"
},
"linux ia32 LE": {
"pkgName": "@icloudpd/linux-ia32",
"subPath": "bin/icloudpd"
},
"linux arm64 LE": {
"pkgName": "@icloudpd/linux-arm64",
"subPath": "bin/icloudpd"
Expand Down
1 change: 0 additions & 1 deletion npm/icloudpd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"optionalDependencies": {
"@icloudpd/linux-arm": "0.0.1",
"@icloudpd/linux-arm64": "0.0.1",
"@icloudpd/linux-ia32": "0.0.1",
"@icloudpd/linux-x64": "0.0.1",
"@icloudpd/win32-x64": "0.0.1",
"@icloudpd/darwin-x64": "0.0.1",
Expand Down
Loading
Loading