Skip to content

Commit 5f07455

Browse files
committed
docker: add a bookworm image
This updates Python to 3.11 and OpenJDK to 1.17.
1 parent 9786b51 commit 5f07455

File tree

3 files changed

+103
-1
lines changed

3 files changed

+103
-1
lines changed

contrib/Dockerfile_bookworm

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# Dockerfile for wally builds on Debain bookworm (stable).
3+
# build from this directory with e.g:
4+
# docker buildx build --platform linux/arm64,linux/amd64 -f Dockerfile_bullseye -t greenaddress/wallycore:bookworm .
5+
#
6+
# Note that to build both platforms you need to:
7+
# apt install qemu-user-static binfmt-support
8+
#
9+
FROM debian:bookworm@sha256:10901ccd8d249047f9761845b4594f121edef079cfd8224edebd9ea726f0a7f6
10+
WORKDIR /root
11+
COPY bookworm_deps.sh ./deps.sh
12+
COPY requirements.txt ./contrib/requirements.txt
13+
ARG TARGETARCH
14+
ENV TARGETARCH=${TARGETARCH}
15+
ENV JAVA_HOME=/usr/lib/jvm/java-1.17.0-openjdk-${TARGETARCH}
16+
RUN ./deps.sh && rm ./deps.sh
17+
ENV ANDROID_NDK=/opt/android-ndk-r26b

contrib/Dockerfile_bullseye

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Dockerfile for wally builds.
2+
# Dockerfile for wally builds on Debain bullseye (oldstable).
33
# build from this directory with e.g:
44
# DOCKER_BUILDKIT=1 docker build . -t greenaddress/wallycore -f Dockerfile_bullseye
55
# and for linux/arm64:

contrib/bookworm_deps.sh

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#! /usr/bin/env bash
2+
# Install required dependencies for building wally
3+
# Options:
4+
# -e : Don't install emsdk (used for JS builds)
5+
# -j : Don't install Java SDK (used for Java builds)
6+
# -n : Don't install Android NDK (used for Android builds)
7+
# -w : Don't install MinGW (used for Windows cross compiles)
8+
set -e
9+
10+
skip_emsdk=
11+
skip_ndk=
12+
skip_java=
13+
skip_windows=
14+
while getopts enjw name
15+
do
16+
case $name in
17+
e) skip_emsdk=1;;
18+
n) skip_ndk=1;;
19+
j) skip_java=1;;
20+
w) skip_windows=1;;
21+
*) echo "Invalid flag"; exit 1;;
22+
esac
23+
done
24+
shift $(($OPTIND - 1))
25+
26+
apt update -qq
27+
apt upgrade -yqq
28+
29+
java_packages=
30+
if [ -z "$skip_java" ]; then
31+
java_packages="openjdk-17-jdk openjdk-17-jre"
32+
fi
33+
windows_packages=
34+
if [ -z "$skip_windows" ]; then
35+
windows_packages="g++-mingw-w64-x86-64"
36+
fi
37+
apt install --no-install-recommends unzip autoconf automake autotools-dev pkg-config build-essential libtool python3{,-dev,-pip,-virtualenv} python{,-dev}-is-python3 clang{,-format,-tidy} git swig curl cmake libssl-dev libtool-bin $java_packages curl $windows_packages valgrind jq -yqq
38+
39+
if [ -z "$skip_java" ]; then
40+
update-java-alternatives -s $(basename ${JAVA_HOME})
41+
fi
42+
43+
# Note --break-system-packages to allow installing our requirements system-wide
44+
pip install valgrind-codequality -r contrib/requirements.txt --break-system-packages
45+
46+
pushd /opt
47+
48+
if [ -z "$skip_ndk" ]; then
49+
curl -L -o ndk.zip https://dl.google.com/android/repository/android-ndk-r26b-linux.zip
50+
echo "ad73c0370f0b0a87d1671ed2fd5a9ac9acfd1eb5c43a7fbfbd330f85d19dd632 ndk.zip" | shasum -a 256 -c
51+
unzip ndk.zip
52+
rm ndk.zip
53+
fi
54+
55+
if [ -z "$skip_emsdk" ]; then
56+
# Install node 20
57+
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
58+
apt install nodejs -yqq
59+
# Install emsdk
60+
git clone https://github.com/emscripten-core/emsdk
61+
cd emsdk
62+
EMSDK_VERSION=3.1.52
63+
if [ "${TARGETARCH}" = "arm64" ]; then
64+
# very few versions of emsdk are available for linux-arm64
65+
# https://github.com/emscripten-core/emsdk/issues/547
66+
EMSDK_VERSION=3.1.33
67+
fi
68+
./emsdk install ${EMSDK_VERSION}
69+
./emsdk activate ${EMSDK_VERSION}
70+
# Force emsdk to use the installed node version instead of its own
71+
sed -i "s/^NODE_JS = .*$/NODE_JS = 'node'/g" /opt/emsdk/.emscripten
72+
# Make emsdk commands available
73+
source ./emsdk_env.sh
74+
fi
75+
76+
if [ -f /.dockerenv ]; then
77+
# Installing dependencies into a docker image.
78+
# Purge uneeded files to keep the image as small as possible.
79+
apt remove --purge curl unzip -yqq
80+
apt -yqq autoremove
81+
apt -yqq clean
82+
rm -rf /var/lib/apt/lists/* /var/cache/* /tmp/* /usr/share/locale/* /usr/share/man /usr/share/doc /lib/xtables/libip6* /root/.cache
83+
fi
84+
85+
popd

0 commit comments

Comments
 (0)