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

Improve build docs and optimize Dockerfile for Android and Linux builds #2016

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
daee381
Update build docs and migrate Android builds to Docker
sethforprivacy Feb 10, 2025
2ae16e5
Update NDK and move steps directly into Dockerfile
sethforprivacy Feb 10, 2025
81a7e57
Fix NDK installation via script and Dockerfile
sethforprivacy Feb 10, 2025
8f3ccbb
Merge branch 'main' into build-docs
sethforprivacy Feb 10, 2025
a30fd87
Migrate to @MrCyjaneK's existing Dockerfile (with optimizations)
sethforprivacy Feb 10, 2025
d07c195
Add .dockerignore and migrate Dockerfile to root of project
sethforprivacy Feb 10, 2025
9e17912
Revert .gitignore changes
sethforprivacy Feb 10, 2025
5b83415
Update Android and Linux builds and resolve Linux build issue
sethforprivacy Feb 10, 2025
6d41302
Fix git repo for Linux and Android build instructions
sethforprivacy Feb 10, 2025
3fee421
Set branch to latest release in build docs
sethforprivacy Feb 10, 2025
8870779
Ensure `flutter clean` is run before building
sethforprivacy Feb 10, 2025
9e19496
Fix Linux completion example
sethforprivacy Feb 11, 2025
1746ab0
Don't build Zano for Linux
sethforprivacy Feb 11, 2025
5284bdd
Apply suggestions from code review
sethforprivacy Feb 11, 2025
ed24a18
Explicitly add automake package to Dockerfile
sethforprivacy Feb 11, 2025
98f7c0e
Merge branch 'main' into build-docs
sethforprivacy Feb 11, 2025
98ce9c8
Improve logging on Android and Linux builds via Docker
sethforprivacy Feb 11, 2025
7f09251
Improve Dockerfile comments and ordering
sethforprivacy Feb 11, 2025
30ebcf6
Fix issues in macOS and iOS builds docs (thanks @MrCyjaneK)
sethforprivacy Feb 11, 2025
1169503
Update docs/builds/IOS.md [skip ci]
MrCyjaneK Feb 11, 2025
45b1d1d
Update docs/builds/IOS.md [skip ci]
MrCyjaneK Feb 11, 2025
5f14d1d
Update docs/builds/MACOS.md [skip ci]
MrCyjaneK Feb 11, 2025
1bc3e26
Update docs/builds/IOS.md [skip ci]
MrCyjaneK Feb 11, 2025
72119b0
Fix and improve iOS and macOS build docs
sethforprivacy Feb 12, 2025
cef5b03
Windows build doc improvements
sethforprivacy Feb 12, 2025
8e951f5
add missing dependency to Dockerfile
MrCyjaneK Feb 12, 2025
76e7b2e
Update Windows build docs
sethforprivacy Feb 13, 2025
507b4b2
Merge branch 'main' into build-docs
sethforprivacy Feb 13, 2025
1aea350
More fixes and optimizations to the Windows build docs
sethforprivacy Feb 13, 2025
4dfbceb
Merge branch 'build-docs' of https://github.com/sethforprivacy/cake_w…
sethforprivacy Feb 13, 2025
6873be2
Add git config to Windows build doc
sethforprivacy Feb 13, 2025
17150ed
Fix shell location/commands in Windows build doc
sethforprivacy Feb 13, 2025
5aacae9
Fix WSL commands in Windows build doc
sethforprivacy Feb 13, 2025
6d6668b
Apply suggestions from code review
sethforprivacy Feb 19, 2025
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
82 changes: 39 additions & 43 deletions scripts/linux/Dockerfile.linux → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ENV ANDROID_SDK_TOOLS_VERSION=11076708
ENV ANDROID_PLATFORM_VERSION=34
ENV ANDROID_BUILD_TOOLS_VERSION=34.0.0

ENV FLUTTER_VERSION=3.24.0
ENV FLUTTER_VERSION=3.24.4

# If we ever need to migrate the home directory...
RUN sed -i 's|^root:[^:]*:[^:]*:[^:]*:[^:]*:/root:|root:x:0:0:root:/root:|' /etc/passwd
Expand All @@ -33,51 +33,49 @@ ENV ANDROID_HOME=/opt/android-sdk-linux \
ENV ANDROID_SDK_ROOT=$ANDROID_HOME \
PATH=${PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/emulator

# Upgrade base image
RUN apt-get update \
&& apt-get upgrade -y

# Install all build dependencies
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 \
&& apt-get install -y --no-install-recommends --no-install-suggests \
# Core dependencies
bc build-essential curl default-jdk git jq lcov libglu1-mesa libpulse0 libsqlite3-dev libstdc++6 locales openssh-client ruby-bundler ruby-full software-properties-common sudo unzip wget zip \
# 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 \
libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libnspr4 libnss3-dev libsqlite3-dev libxtst6 libxss1 lftp sqlite3 xxd \
# Linux desktop dependencies
clang cmake libgtk-3-dev ninja-build pkg-config \
# monero_c dependencies
&& apt-get install -y ccache build-essential autoconf libtool gperf llvm \
autoconf build-essential ccache gperf libtool 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/* \
bridge-utils libvirt-clients libvirt-daemon-system qemu-kvm udev \
# Linux test dependencies
ffmpeg network-manager x11-utils xvfb \
# aarch64-linux-gnu dependencies
g++-aarch64-linux-gnu gcc-aarch64-linux-gnu \
&& apt clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& 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
# Install nodejs for Github Actions
RUN curl -fsSL https://deb.nodesource.com/setup_23.x | bash - && \
apt-get install -y --no-install-recommends nodejs && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install Go
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 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 && \
go install golang.org/x/mobile/cmd/gomobile@latest && \
gomobile init

# Install Android SDK commandline tools
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/ \
Expand All @@ -94,10 +92,10 @@ RUN wget -q https://dl.google.com/android/repository/commandlinetools-linux-${AN
&& git config --global user.email "[email protected]" \
&& git config --global user.name "CakeWallet CI"

# emulator is not available on linux/arm64 (https://issuetracker.google.com/issues/227219818)
# Handle emulator not being 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
# Pre-install extra Android SDK dependencies in order to not have to download them for each build
RUN yes | sdkmanager \
"platforms;android-$ANDROID_PLATFORM_VERSION" \
"build-tools;$ANDROID_BUILD_TOOLS_VERSION" \
Expand All @@ -107,9 +105,8 @@ RUN yes | sdkmanager \
"build-tools;33.0.0" \
"build-tools;35.0.0"

# Install extra NDK dependency for sp_scanner
ENV ANDROID_NDK_VERSION=27.2.12479018

# Extra ndk dependency for sp_scanner
RUN yes | sdkmanager "ndk;$ANDROID_NDK_VERSION" \
"ndk;27.0.12077973"

Expand All @@ -119,32 +116,31 @@ RUN yes | sdkmanager "system-images;android-29;default;x86" \
"system-images;android-31;default;x86_64" \
"platforms;android-29"

# fake the KVM status so android emulator doesn't complain (that much)
# 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

# Install rustup, rust toolchains, and cargo-ndk
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


# Download and install Flutter
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 \
RUN git clone --depth 1 --branch ${FLUTTER_VERSION} https://github.com/flutter/flutter.git ${FLUTTER_HOME} \
&& yes | flutter doctor --android-licenses \
&& flutter doctor \
&& chown -R root:root ${FLUTTER_HOME}

# Download and pre-cache necessary Flutter artifacts to speed up builds
RUN flutter precache
176 changes: 0 additions & 176 deletions build-guide-linux.md

This file was deleted.

38 changes: 0 additions & 38 deletions build-guide-win.md

This file was deleted.

File renamed without changes.
File renamed without changes.
Loading
Loading