mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
Improve build docs and optimize Dockerfile for Android and Linux builds (#2016)
* Update build docs and migrate Android builds to Docker * Update NDK and move steps directly into Dockerfile * Fix NDK installation via script and Dockerfile * Migrate to @MrCyjaneK's existing Dockerfile (with optimizations) * Add .dockerignore and migrate Dockerfile to root of project * Revert .gitignore changes * Update Android and Linux builds and resolve Linux build issue * Fix git repo for Linux and Android build instructions * Set branch to latest release in build docs * Ensure `flutter clean` is run before building * Fix Linux completion example * Don't build Zano for Linux * Apply suggestions from code review Co-authored-by: cyan <cyjan@mrcyjanek.net> * Explicitly add automake package to Dockerfile * Improve logging on Android and Linux builds via Docker * Improve Dockerfile comments and ordering * Fix issues in macOS and iOS builds docs (thanks @MrCyjaneK) * Update docs/builds/IOS.md [skip ci] * Update docs/builds/IOS.md [skip ci] * Update docs/builds/MACOS.md [skip ci] * Update docs/builds/IOS.md [skip ci] * Fix and improve iOS and macOS build docs * Windows build doc improvements Co-authored-by: cyan <cyjan@mrcyjanek.net> * add missing dependency to Dockerfile * Update Windows build docs * More fixes and optimizations to the Windows build docs * Add git config to Windows build doc * Fix shell location/commands in Windows build doc * Fix WSL commands in Windows build doc * Apply suggestions from code review Co-authored-by: cyan <cyjan@mrcyjanek.net> --------- Co-authored-by: cyan <cyjan@mrcyjanek.net>
This commit is contained in:
parent
be4e0d6ac8
commit
1cb8651ffc
18 changed files with 594 additions and 700 deletions
|
@ -6,9 +6,9 @@ TOOLCHAIN_A32_DIR=${TOOLCHAIN_DIR}_aarch
|
|||
TOOLCHAIN_A64_DIR=${TOOLCHAIN_DIR}_aarch64
|
||||
TOOLCHAIN_x86_DIR=${TOOLCHAIN_DIR}_i686
|
||||
TOOLCHAIN_x86_64_DIR=${TOOLCHAIN_DIR}_x86_64
|
||||
ANDROID_NDK_SHA256="3f541adbd0330a9205ba12697f6d04ec90752c53d6b622101a2a8a856e816589"
|
||||
ANDROID_NDK_SHA256="7a1302d9bfbc37d46be90b2285f4737508ffe08a346cf2424c5c6a744de2db22"
|
||||
|
||||
curl https://dl.google.com/android/repository/android-ndk-r17c-linux-x86_64.zip -o ${ANDROID_NDK_ZIP}
|
||||
curl https://dl.google.com/android/repository/android-ndk-r27c-linux.zip -o ${ANDROID_NDK_ZIP}
|
||||
echo $ANDROID_NDK_SHA256 $ANDROID_NDK_ZIP | sha256sum -c || exit 1
|
||||
unzip $ANDROID_NDK_ZIP -d $WORKDIR
|
||||
|
||||
|
|
|
@ -1,150 +0,0 @@
|
|||
# Usage:
|
||||
# docker build . -f Dockerfile.linux -t ghcr.io/cake-tech/cake_wallet:main-linux
|
||||
# docker push ghcr.io/cake-tech/cake_wallet:main-linux
|
||||
|
||||
FROM --platform=linux/amd64 docker.io/debian:12
|
||||
|
||||
LABEL org.opencontainers.image.source=https://github.com/cake-tech/cake_wallet
|
||||
|
||||
ENV GOLANG_VERSION=1.23.4
|
||||
# comes from https://developer.android.com/studio/#command-tools
|
||||
ENV ANDROID_SDK_TOOLS_VERSION=11076708
|
||||
# https://developer.android.com/studio/releases/build-tools
|
||||
ENV ANDROID_PLATFORM_VERSION=34
|
||||
ENV ANDROID_BUILD_TOOLS_VERSION=34.0.0
|
||||
|
||||
ENV FLUTTER_VERSION=3.24.0
|
||||
|
||||
# If we ever need to migrate the home directory...
|
||||
RUN sed -i 's|^root:[^:]*:[^:]*:[^:]*:[^:]*:/root:|root:x:0:0:root:/root:|' /etc/passwd
|
||||
# mkdir -p /root && rm -rf /root && cp -a /root /root
|
||||
ENV HOME=/root
|
||||
# Heavily inspired by cirrusci images
|
||||
# https://github.com/cirruslabs/docker-images-android/blob/master/sdk/tools/Dockerfile
|
||||
# https://github.com/cirruslabs/docker-images-android/blob/master/sdk/34/Dockerfile
|
||||
# https://github.com/cirruslabs/docker-images-android/blob/master/sdk/34-ndk/Dockerfile
|
||||
# https://github.com/cirruslabs/docker-images-flutter/blob/master/sdk/Dockerfile
|
||||
|
||||
ENV ANDROID_HOME=/opt/android-sdk-linux \
|
||||
LANG=en_US.UTF-8 \
|
||||
LC_ALL=en_US.UTF-8 \
|
||||
LANGUAGE=en_US:en
|
||||
|
||||
ENV ANDROID_SDK_ROOT=$ANDROID_HOME \
|
||||
PATH=${PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/emulator
|
||||
|
||||
RUN set -o xtrace \
|
||||
&& cd /opt \
|
||||
&& apt-get update \
|
||||
&& apt-get upgrade -y \
|
||||
&& apt-get install -y jq \
|
||||
&& apt-get install -y default-jdk \
|
||||
&& apt-get install -y sudo wget zip unzip git openssh-client curl bc software-properties-common build-essential ruby-full ruby-bundler libstdc++6 libpulse0 libglu1-mesa locales lcov libsqlite3-dev --no-install-recommends \
|
||||
# for x86 emulators
|
||||
&& apt-get install -y libxtst6 libnss3-dev libnspr4 libxss1 libatk-bridge2.0-0 libgtk-3-0 libgdk-pixbuf2.0-0 \
|
||||
&& apt-get install -y -qq xxd \
|
||||
&& apt-get install -y lftp \
|
||||
&& apt-get install -qq -y sqlite3 libsqlite3-dev \
|
||||
# linux desktop dependencies
|
||||
&& apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev \
|
||||
# monero_c dependencies
|
||||
&& apt-get install -y ccache build-essential autoconf libtool gperf llvm \
|
||||
# extra stuff for KVM
|
||||
&& apt-get install -y udev qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils \
|
||||
# for linux tests
|
||||
&& apt-get install -y xvfb network-manager ffmpeg x11-utils \
|
||||
# for aarch64-linux-gnu
|
||||
&& apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& sh -c 'echo "en_US.UTF-8 UTF-8" > /etc/locale.gen' \
|
||||
&& locale-gen \
|
||||
&& update-locale LANG=en_US.UTF-8
|
||||
|
||||
# install nodejs for actions
|
||||
RUN apt-get update && \
|
||||
apt-get install -y curl && \
|
||||
curl -fsSL https://deb.nodesource.com/setup_23.x | bash - && \
|
||||
apt-get install -y nodejs && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN wget https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz &&\
|
||||
rm -rf /usr/local/go &&\
|
||||
tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz
|
||||
|
||||
ENV PATH=${PATH}:/usr/local/go/bin:${HOME}/go/bin
|
||||
ENV GOROOT=/usr/local/go
|
||||
ENV GOPATH=${HOME}/go
|
||||
RUN go install golang.org/x/mobile/cmd/gomobile@latest
|
||||
RUN gomobile init
|
||||
|
||||
RUN wget -q https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS_VERSION}_latest.zip -O android-sdk-tools.zip \
|
||||
&& mkdir -p ${ANDROID_HOME}/cmdline-tools/ \
|
||||
&& unzip -q android-sdk-tools.zip -d ${ANDROID_HOME}/cmdline-tools/ \
|
||||
&& mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/latest \
|
||||
&& chown -R root:root $ANDROID_HOME \
|
||||
&& rm android-sdk-tools.zip \
|
||||
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
|
||||
&& yes | sdkmanager --licenses \
|
||||
&& wget -O /usr/bin/android-wait-for-emulator https://raw.githubusercontent.com/travis-ci/travis-cookbooks/master/community-cookbooks/android-sdk/files/default/android-wait-for-emulator \
|
||||
&& chmod +x /usr/bin/android-wait-for-emulator \
|
||||
&& sdkmanager platform-tools \
|
||||
&& mkdir -p ${HOME}/.android \
|
||||
&& touch ${HOME}/.android/repositories.cfg \
|
||||
&& git config --global user.email "czarek@cakewallet.com" \
|
||||
&& git config --global user.name "CakeWallet CI"
|
||||
|
||||
# emulator is not available on linux/arm64 (https://issuetracker.google.com/issues/227219818)
|
||||
RUN if [ $(uname -m) == "x86_64" ]; then sdkmanager emulator ; fi
|
||||
|
||||
# Extra dependencies to not download them for cake wallet build
|
||||
RUN yes | sdkmanager \
|
||||
"platforms;android-$ANDROID_PLATFORM_VERSION" \
|
||||
"build-tools;$ANDROID_BUILD_TOOLS_VERSION" \
|
||||
"platforms;android-33" \
|
||||
"build-tools;33.0.2" \
|
||||
"build-tools;33.0.1" \
|
||||
"build-tools;33.0.0" \
|
||||
"build-tools;35.0.0"
|
||||
|
||||
ENV ANDROID_NDK_VERSION=27.2.12479018
|
||||
|
||||
# Extra ndk dependency for sp_scanner
|
||||
RUN yes | sdkmanager "ndk;$ANDROID_NDK_VERSION" \
|
||||
"ndk;27.0.12077973"
|
||||
|
||||
# https://github.com/ReactiveCircus/android-emulator-runner dependencies for tests
|
||||
RUN yes | sdkmanager "system-images;android-29;default;x86" \
|
||||
"system-images;android-29;default;x86_64" \
|
||||
"system-images;android-31;default;x86_64" \
|
||||
"platforms;android-29"
|
||||
|
||||
# fake the KVM status so android emulator doesn't complain (that much)
|
||||
RUN (addgroup kvm || true) && \
|
||||
adduser root kvm && \
|
||||
mkdir -p /etc/udev/rules.d/ && \
|
||||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | tee /etc/udev/rules.d/99-kvm4all.rules
|
||||
|
||||
ENV PATH=${HOME}/.cargo/bin:${PATH}
|
||||
|
||||
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y && \
|
||||
cargo install cargo-ndk && \
|
||||
for target in aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android x86_64-unknown-linux-gnu; \
|
||||
do \
|
||||
rustup target add --toolchain stable $target; \
|
||||
done
|
||||
|
||||
|
||||
ENV HOME=${HOME}
|
||||
ENV FLUTTER_HOME=${HOME}/sdks/flutter/${FLUTTER_VERSION}
|
||||
ENV FLUTTER_ROOT=$FLUTTER_HOME
|
||||
|
||||
ENV PATH=${PATH}:${FLUTTER_HOME}/bin:${FLUTTER_HOME}/bin/cache/dart-sdk/bin
|
||||
|
||||
RUN git clone --depth 1 --branch ${FLUTTER_VERSION} https://github.com/flutter/flutter.git ${FLUTTER_HOME}
|
||||
|
||||
RUN yes | flutter doctor --android-licenses \
|
||||
&& flutter doctor \
|
||||
&& chown -R root:root ${FLUTTER_HOME}
|
||||
|
||||
RUN flutter precache
|
|
@ -7,7 +7,7 @@ cd "$(dirname "$0")"
|
|||
|
||||
../prepare_moneroc.sh
|
||||
|
||||
for COIN in monero wownero zano;
|
||||
for COIN in monero wownero;
|
||||
do
|
||||
pushd ../monero_c
|
||||
for target in x86_64-linux-gnu # aarch64-linux-gnu
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue