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

Add docker scripts to simplify setting up idevicerestore #562

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,16 @@ jobs:
with:
name: idevicerestore-latest_${{ matrix.arch }}-${{ env.dest }}
path: idevicerestore.tar
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: build
run: |
pushd docker && ./build.sh; popd
docker image save -o idevicerestore-docker.tar idevicerestore-docker
- name: publish artifact
uses: actions/upload-artifact@v4
with:
name: idevicerestore-latest_docker
path: idevicerestore-docker.tar
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,15 @@ idevicerestore --help
man idevicerestore
```

### Docker

Build the container with `build.sh` in the docker folder, which will build a
docker container with the latest source versions of all the required libraries.

Run the container with `run.sh --latest` in the docker folder,
which will execute `usbmuxd` in the background, and then start `idevicerestore --latest`.
Any arguments passed to `run.sh` will be passed in to `idevicerestore`.

## Contributing

We welcome contributions from anyone and are grateful for every pull request!
Expand Down
89 changes: 89 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
FROM ubuntu:24.04

ENV DEBIAN_FRONTEND="noninteractive"
RUN apt-get update && apt-get install -y \
build-essential \
pkg-config \
checkinstall \
git \
autoconf \
automake \
libtool-bin \
libreadline-dev \
libusb-1.0-0-dev \
libcurl4-openssl-dev \
libssl-dev \
libzip-dev \
zlib1g-dev \
python3 \
udev

RUN git clone https://github.com/libimobiledevice/libplist.git && \
cd libplist && \
./autogen.sh && \
make && \
make install && \
cd .. && \
rm libplist -rf

RUN git clone https://github.com/libimobiledevice/libtatsu.git && \
cd libtatsu && \
./autogen.sh && \
make && \
make install && \
cd .. && \
rm libtatsu -rf

RUN git clone https://github.com/libimobiledevice/libimobiledevice-glue.git && \
cd libimobiledevice-glue && \
./autogen.sh && \
make && \
make install && \
cd .. && \
rm libimobiledevice-glue -rf

RUN git clone https://github.com/libimobiledevice/libusbmuxd.git && \
cd libusbmuxd && \
./autogen.sh && \
make && \
make install && \
cd .. && \
rm libusbmuxd -rf

RUN git clone https://github.com/libimobiledevice/libimobiledevice.git && \
cd libimobiledevice && \
./autogen.sh && \
make && \
make install && \
cd .. && \
rm libimobiledevice -rf

RUN git clone https://github.com/libimobiledevice/libirecovery.git && \
cd libirecovery && \
./autogen.sh && \
make && \
make install && \
cd .. && \
rm libirecovery -rf

RUN git clone https://github.com/libimobiledevice/usbmuxd.git && \
cd usbmuxd && \
./autogen.sh && \
make && \
make install && \
cd .. && \
rm usbmuxd -rf

RUN git clone https://github.com/libimobiledevice/idevicerestore.git && \
cd idevicerestore && \
./autogen.sh && \
make && \
make install && \
cd .. && \
rm idevicerestore -rf

RUN ldconfig
WORKDIR /tmp
COPY idevicerestore.sh /usr/sbin/idevicerestore.sh
CMD idevicerestore.sh

8 changes: 8 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -e
cd "$(dirname "$0")"

docker build . -t idevicerestore-docker --no-cache

echo "You can now use 'run.sh --latest' to run the restore."

7 changes: 7 additions & 0 deletions docker/idevicerestore.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -e

usbmuxd &

idevicerestore "$@"

13 changes: 13 additions & 0 deletions docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -e
cd "$(dirname "$0")"

if [[ -z $(docker images | grep idevicerestore-docker) ]]; then
echo "Container not built, you will need to build it with 'build.sh'"
exit -1
fi

docker rm --force idevicerestore || true

docker run --name idevicerestore -it --privileged --net=host -v /dev:/dev -v /run/udev/control:/run/udev/control -v "$(pwd):/tmp" idevicerestore-docker idevicerestore.sh "$@"