Skip to content

Commit

Permalink
Add support for --docker-install with an example Dockerfile and som…
Browse files Browse the repository at this point in the history
…e docs on how to use it.
  • Loading branch information
dmp1ce committed Nov 18, 2021
1 parent 3ff01d7 commit 180ef1e
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 27 deletions.
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM debian:buster-slim

RUN mkdir -p /jm/clientserver
WORKDIR /jm/clientserver

COPY . .

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates=* curl=* \
python3-pip=* \
&& pip3 install 'wheel>=0.35.1' \
&& ./install.sh --docker-install \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Alternative to this "quickstart": follow the [install guide](docs/INSTALL.md).
### More installation guides

* [Installation on Windows](docs/INSTALL.md#installation-on-windows).
* [Installation with Docker.](docs/INSTALL.md)
* [Installation guide for RaspiBlitz](https://github.com/openoms/bitcoin-tutorials/blob/master/joinmarket/README.md).
* [Installation guide for RaspiBolt](https://github.com/kristapsk/raspibolt-extras/blob/master/joinmarket.md).
* [Installation guide for Qubes+Whonix](https://github.com/qubenix/qubes-whonix-bitcoin/blob/master/1_joinmarket.md).
Expand Down
11 changes: 11 additions & 0 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,17 @@ There, you need to install the client code (without Joinmarket's bitcoin):
python setupall.py --client-only
#### Docker Installation
The [Dockerfile](Dockerfile) provided builds a minimal Docker image which can help in getting started with a custom Docker setup. An example of building and running the [wallet-tool.py](scripts/wallet-tool.py) script:
```
docker build -t joinmarket-test ./
docker run --rm -it joinmarket-test bash -c "cd scripts && python3 wallet-tool.py --help"
```
A new Docker image can be built using `joinmarket-test` as a base using `FROM joinmarket-test`. See [Docker documentation](https://docs.docker.com/engine/reference/builder/) for more details.
#### Development (or making other changes to the code)
If you are a developer or you plan on modifying the code (for example to add customizations),
Expand Down
79 changes: 52 additions & 27 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ deps_install ()
'libtool' \
'libgmp-dev' \
'python3-dev' \
'virtualenv' \
'python3-pip' )
'python3-pip' \
'python3-setuptools' \
'libltdl-dev' )

if [ "$with_jmvenv" == 1 ]; then common_deps+=("virtualenv"); fi
if [ "$with_sudo" == 1 ]; then common_deps+=("sudo"); fi

darwin_deps=( \
'automake' \
Expand Down Expand Up @@ -85,13 +89,18 @@ deb_deps_install ()
deb_deps=( ${@} )
if deb_deps_check; then
clear
echo "
sudo password required to run :
sudo_command=''
if [ "$with_sudo" == 1 ]; then
echo "
sudo password required to run :
\`apt-get install ${deb_deps[@]}\`
"
sudo_command="sudo"
fi

\`apt-get install ${deb_deps[@]}\`
"
if ! sudo apt-get install ${deb_deps[@]}; then
return 1
if ! $sudo_command apt-get install -y --no-install-recommends ${deb_deps[@]}; then
return 1
fi
fi
}
Expand Down Expand Up @@ -317,7 +326,8 @@ joinmarket_install ()
fi

for req in ${reqs[@]}; do
pip install -r "requirements/${req}" || return 1
if [ "$with_jmvenv" == 1 ]; then pip_command=pip; else pip_command=pip3; fi
$pip_command install -r "requirements/${req}" || return 1
done

if [[ ${with_qt} == "1" ]]; then
Expand Down Expand Up @@ -367,6 +377,10 @@ parse_flags ()
--without-qt)
with_qt='0'
;;
--docker-install)
with_sudo='0'
with_jmvenv='0'
;;
"")
break
;;
Expand All @@ -382,6 +396,7 @@ Options:
--python, -p python version (only python3 versions are supported)
--with-qt build the Qt GUI
--without-qt don't build the Qt GUI
--docker-install system wide install as root for minimal Docker installs
"
return 1
;;
Expand Down Expand Up @@ -433,37 +448,45 @@ install_get_os ()

main ()
{
jm_source="$PWD"
jm_root="${jm_source}/jmvenv"
jm_deps="${jm_source}/deps"
export PKG_CONFIG_PATH="${jm_root}/lib/pkgconfig:${PKG_CONFIG_PATH}"
export LD_LIBRARY_PATH="${jm_root}/lib:${LD_LIBRARY_PATH}"
export C_INCLUDE_PATH="${jm_root}/include:${C_INCLUDE_PATH}"
export MAKEFLAGS='-j'

# flags
develop_build=''
python='python3'
use_os_deps_check='1'
use_secp_check='1'
with_qt=''
with_jmvenv='1'
with_sudo='1'
reinstall='false'
if ! parse_flags ${@}; then
return 1
fi

jm_source="$PWD"
if [ "$with_jmvenv" == 1 ]; then
jm_root="${jm_source}/jmvenv"
else
jm_root="${jm_source}"
fi
jm_deps="${jm_source}/deps"
export PKG_CONFIG_PATH="${jm_root}/lib/pkgconfig:${PKG_CONFIG_PATH}"
export LD_LIBRARY_PATH="${jm_root}/lib:${LD_LIBRARY_PATH}"
export C_INCLUDE_PATH="${jm_root}/include:${C_INCLUDE_PATH}"
export MAKEFLAGS='-j'

# os check
install_os="$( install_get_os )"

if ! deps_install; then
echo "Dependecies could not be installed. Exiting."
return 1
fi
if ! venv_setup; then
echo "Joinmarket virtualenv could not be setup. Exiting."
return 1
if [ "$with_jmvenv" == 1 ]; then
if ! venv_setup; then
echo "Joinmarket virtualenv could not be setup. Exiting."
return 1
fi
source "${jm_root}/bin/activate"
fi
source "${jm_root}/bin/activate"
mkdir -p "deps/cache"
pushd deps
if ! libsecp256k1_install; then
Expand All @@ -481,15 +504,17 @@ main ()
popd
if ! joinmarket_install; then
echo "Joinmarket was not installed. Exiting."
deactivate
if [ "$with_jmvenv" == 1 ]; then deactivate; fi
return 1
fi
deactivate
echo "Joinmarket successfully installed
Before executing scripts or tests, run:
if [ "$with_jmvenv" == 1 ]; then
deactivate
echo "Joinmarket successfully installed
Before executing scripts or tests, run:
\`source jmvenv/bin/activate\`
\`source jmvenv/bin/activate\`
from this directory, to activate virtualenv."
from this directory, to activate virtualenv."
fi
}
main ${@}

0 comments on commit 180ef1e

Please sign in to comment.