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

I am trying to build sc.elitewallet.elitewallet using this Dockerfile #12

Open
xrviv opened this issue Jan 17, 2024 · 8 comments
Open

Comments

@xrviv
Copy link

xrviv commented Jan 17, 2024

# Use Ubuntu as the base image
FROM ubuntu:20.04

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV ANDROID_SDK_ROOT=/opt/android-sdk
ENV FLUTTER_HOME=/opt/flutter
ENV PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools:$FLUTTER_HOME/bin"

# Install required packages including Bash
RUN apt-get update && \
    apt-get install -y curl unzip automake build-essential file pkg-config git python libtool libtinfo5 cmake openjdk-8-jdk-headless clang bison byacc gperf groff bash

# [previous commands for installing Android SDK, NDK, and Flutter]

# Clone the EliteWallet repository
RUN git clone https://github.com/Elite-Labs/EliteWallet.git elite_wallet --branch master && \
    cd elite_wallet && \
    git submodule update --init --force

# Set the working directory to the cloned repository
WORKDIR /elite_wallet

# Add build commands using Bash
RUN bash ./scripts/build_deps.sh
RUN bash ./scripts/build.sh

# [Optional ENTRYPOINT or CMD]

@xrviv
Copy link
Author

xrviv commented Jan 17, 2024

This was not successful, so I instead tried to follow the instructions in https://github.com/Elite-Labs/EliteWallet/blob/master/howto-build-android.md

I have a question about this:

$ sudo apt-get install -y curl unzip automake build-essential file pkg-config git python libtool libtinfo5 cmake openjdk-8-jre-headless clang bison byacc gperf groff

Are you sure that this is simply python and not python3 ?

I am on an ubuntu 22.04 machine

I was able to reach this point:

dannybuntu@z0:~/Work/builds/android/sc.elitewallet.elitewallet/1.1.7/elite_wallet/scripts/android$ **./app_config.sh**
rm: cannot remove '/home/dannybuntu/Work/builds/android/sc.elitewallet.elitewallet/1.1.7/elite_wallet/scripts/android/../../assets/images/app_logo.png': No such file or directory
rm: cannot remove '/home/dannybuntu/Work/builds/android/sc.elitewallet.elitewallet/1.1.7/elite_wallet/scripts/android/../../android/app/src/main/res/drawable/ic_launcher.png': No such file or directory
Downloading Linux x64 Dart SDK from Flutter engine 1a65d409c7a1438a34d21b60bf30a6fd5db59314...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  238M  100  238M    0     0  4476k      0  0:00:54  0:00:54 --:--:-- 4297k
Building flutter tool...
Downloading Material fonts...                                    1,989ms
Downloading Gradle Wrapper...                                      220ms
Downloading package sky_engine...                                1,242ms
Downloading flutter_patched_sdk tools...                            4.5s
Downloading flutter_patched_sdk_product tools...                    6.0s
Downloading linux-x64 tools...                                     14.1s
Downloading linux-x64/font-subset tools...                       1,523ms
Running "flutter pub get" in elite_wallet...
Resolving dependencies... 
Got dependencies!
This app is using a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to migrate this app to the V2 embedding.
Take a look at the docs for migrating an app: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
Running "flutter pub get" in elite_wallet...
Resolving dependencies... (59:14.1s)

@Elite-Labs
Copy link
Owner

Elite-Labs commented Jan 23, 2024

Are you sure that this is simply python and not python3 ?

We are currently building project using python2.

Resolving dependencies... (59:14.1s)

It looks like flutter is resolving dependencies for a long period which should't be the case. I would try to debug why did it take so much time.

All log messages before that are expected during a build.

@xrviv
Copy link
Author

xrviv commented Jan 30, 2024

Attempting again today. This time with this Dockerfile. Could you assist in making one for your project?

# Use Ubuntu 20.04 as the base image
FROM ubuntu:20.04

# Set environment variables to avoid interactive dialog during installation
ENV DEBIAN_FRONTEND=noninteractive \
    ANDROID_HOME=/usr/local/android-sdk \
    ANDROID_NDK_HOME=/usr/local/android-ndk \
    FLUTTER_HOME=/usr/local/flutter

# Install system dependencies
RUN apt-get update && apt-get install -y \
    curl \
    unzip \
    automake \
    build-essential \
    file \
    pkg-config \
    git \
    python \
    libtool \
    libtinfo5 \
    cmake \
    openjdk-8-jre-headless \
    clang \
    bison \
    byacc \
    gperf \
    groff

# Set up PATH
ENV PATH="${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${ANDROID_NDK_HOME}:${FLUTTER_HOME}/bin"

# Download and install Android SDK and NDK, and Flutter
RUN mkdir -p $ANDROID_HOME && \
    curl -o commandlinetools.zip 'https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip' && \
    unzip commandlinetools.zip -d $ANDROID_HOME/cmdline-tools && \
    rm commandlinetools.zip && \
    yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --licenses && \
    $ANDROID_HOME/cmdline-tools/bin/sdkmanager "platform-tools" "build-tools;29.0.3" "platforms;android-29" && \
    curl -o ndk.zip 'https://dl.google.com/android/repository/android-ndk-r17c-linux-x86_64.zip' && \
    unzip ndk.zip -d /usr/local && \
    mv /usr/local/android-ndk-r17c $ANDROID_NDK_HOME && \
    rm ndk.zip && \
    git clone -b stable https://github.com/flutter/flutter.git $FLUTTER_HOME && \
    flutter doctor

# Clone the EliteWallet repository
RUN git clone https://github.com/Elite-Labs/EliteWallet.git /elite_wallet --branch master

# Set the working directory
WORKDIR /elite_wallet

# Run build scripts
RUN ./scripts/build_deps.sh && \
    ./scripts/build.sh

# Define the entrypoint
CMD ["/bin/bash"]

@xrviv
Copy link
Author

xrviv commented Jan 30, 2024

I will try again, this time, manually. But I'd appreciate if you can perhaps share a dockerfile

image

@xrviv
Copy link
Author

xrviv commented Jan 30, 2024

A manual build using docker also failed.

root@3203f6808cac:~/downloads/elite_wallet2/elite_wallet# ls
LICENSE.md             assets       ew_monero               lib           pubspec_base.yaml         tool
PRIVACY.md             ew_bitcoin   ew_shared_external      macos         pubspec_description.yaml
README.md              ew_core      ew_wownero              metadata      res
analysis_options.yaml  ew_ethereum  howto-build-android.md  patches       scripts
android                ew_haven     ios                     pubspec.yaml  test
root@3203f6808cac:~/downloads/elite_wallet2/elite_wallet# ls -l /root/downloads/elite_wallet2/elite_wallet/.flutter
total 0
lrwxrwxrwx 1 root root 18 Jan 30 07:16 flutter -> /usr/local/flutter
root@3203f6808cac:~/downloads/elite_wallet2/elite_wallet# export PATH="$PATH:/usr/local/flutter/bin"
root@3203f6808cac:~/downloads/elite_wallet2/elite_wallet# which flutter
/usr/local/flutter/bin/flutter
root@3203f6808cac:~/downloads/elite_wallet2/elite_wallet# ./scripts/build.sh
./pubspec_gen.sh: line 26: .flutter/bin/flutter: No such file or directory
./pubspec_gen.sh: line 27: .flutter/bin/flutter: No such file or directory
./pubspec_gen.sh: line 28: .flutter/bin/flutter: No such file or directory
./pubspec_gen.sh: line 29: .flutter/bin/flutter: No such file or directory
./scripts/build.sh: line 8: .flutter/bin/flutter: No such file or directory
./scripts/build.sh: line 9: .flutter/bin/flutter: No such file or directory
./scripts/build.sh: line 11: .flutter/bin/flutter: No such file or directory
./scripts/build.sh: line 12: .flutter/bin/flutter: No such file or directory
./scripts/build.sh: line 14: ../.flutter/bin/flutter: No such file or directory
./scripts/build.sh: line 15: cd: ew_monero: No such file or directory
./scripts/build.sh: line 16: cd: ew_bitcoin: No such file or directory
./scripts/build.sh: line 17: cd: ew_haven: No such file or directory
./scripts/build.sh: line 17: ../.flutter/bin/flutter: No such file or directory
./scripts/build.sh: line 18: ../.flutter/bin/flutter: No such file or directory
./scripts/build.sh: line 18: ../.flutter/bin/flutter: No such file or directory
./scripts/build.sh: line 19: ../.flutter/bin/flutter: No such file or directory
./scripts/build.sh: line 20: .flutter/bin/flutter: No such file or directory
./scripts/build.sh: line 23: .flutter/bin/flutter: No such file or directory
root@3203f6808cac:~/downloads/elite_wallet2/elite_wallet# ls
LICENSE.md             assets       ew_monero               lib           pubspec_base.yaml         tool
PRIVACY.md             ew_bitcoin   ew_shared_external      macos         pubspec_description.yaml
README.md              ew_core      ew_wownero              metadata      res
analysis_options.yaml  ew_ethereum  howto-build-android.md  patches       scripts
android                ew_haven     ios                     pubspec.yaml  test
root@3203f6808cac:~/downloads/elite_wallet2/elite_wallet# 

During manual build, when executing ./scripts/build.sh

At this point, I would have to edit build.sh (which I should not do) in order to point to the correct flutter directory. I tried making a symbolic link, but that also failed.

@chdwlch
Copy link

chdwlch commented Apr 25, 2024

I was able to get an Android build completed with this initial Dockerfile.

FROM ubuntu:20.04

ENV UID=1000
ENV GID=1000
ENV USER="developer"
ENV JAVA_VERSION="11"
ENV ANDROID_TOOLS_URL="https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip"
ENV ANDROID_VERSION="33"
ENV ANDROID_BUILD_TOOLS_VERSION="33.0.2"
ENV ANDROID_ARCHITECTURE="x86_64"
ENV ANDROID_SDK_ROOT="/home/$USER/android"
ENV FLUTTER_CHANNEL="stable"
ENV FLUTTER_VERSION="3.10.6"
ENV FLUTTER_URL="https://storage.googleapis.com/flutter_infra_release/releases/$FLUTTER_CHANNEL/linux/flutter_linux_3.10.6-$FLUTTER_CHANNEL.tar.xz"
ENV FLUTTER_HOME="/home/$USER/flutter"
ENV FLUTTER_WEB_PORT="8090"
ENV FLUTTER_DEBUG_PORT="42000"
ENV FLUTTER_EMULATOR_NAME="flutter_emulator"
ENV PATH="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/platforms:$FLUTTER_HOME/bin:$PATH"

ENV APP_ANDROID_TYPE="elitewallet"
ENV APP_ANDROID_NAME="Elite Wallet"
ENV APP_ANDROID_VERSION="1.3.1"
ENV APP_ANDROID_BUILD_NUMBER=16
ENV APP_ANDROID_BUNDLE_ID="sc.elitewallet.elitewallet"
ENV APP_ANDROID_PACKAGE="sc.elitewallet.elitewallet"
ENV APP_ANDROID_SCHEME="elitewallet"

# install all dependencies
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
  && apt-get install --yes --no-install-recommends openjdk-$JAVA_VERSION-jdk curl unzip sed git bash xz-utils libglvnd0 ssh xauth x11-xserver-utils libpulse0 libxcomposite1 libgl1-mesa-glx sudo \
  curl unzip automake build-essential file pkg-config git python2 libtool libtinfo5 cmake openjdk-11-jre-headless clang bison byacc gperf groff \
  && rm -rf /var/lib/{apt,dpkg,cache,log} \
  && ln -s /usr/bin/python2 /usr/bin/python

# create user
RUN groupadd --gid $GID $USER \
  && useradd -s /bin/bash --uid $UID --gid $GID -m $USER \
  && echo $USER ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USER \
  && chmod 0440 /etc/sudoers.d/$USER

USER $USER
WORKDIR /home/$USER

# android sdk
RUN mkdir -p $ANDROID_SDK_ROOT \
  && mkdir -p /home/$USER/.android \
  && touch /home/$USER/.android/repositories.cfg \
  && curl -o android_tools.zip $ANDROID_TOOLS_URL \
  && unzip -qq -d "$ANDROID_SDK_ROOT" android_tools.zip \
  && rm android_tools.zip \
  && mkdir -p $ANDROID_SDK_ROOT/cmdline-tools/latest \
  && mv $ANDROID_SDK_ROOT/cmdline-tools/bin $ANDROID_SDK_ROOT/cmdline-tools/latest \
  && mv $ANDROID_SDK_ROOT/cmdline-tools/lib $ANDROID_SDK_ROOT/cmdline-tools/latest \
  && yes "y" | sdkmanager "build-tools;$ANDROID_BUILD_TOOLS_VERSION" \
  && yes "y" | sdkmanager "platforms;android-$ANDROID_VERSION" \
  && yes "y" | sdkmanager "platform-tools" \
  && yes "y" | sdkmanager "emulator" \
  && yes "y" | sdkmanager "system-images;android-$ANDROID_VERSION;google_apis_playstore;$ANDROID_ARCHITECTURE"

# flutter
RUN curl -o flutter.tar.xz $FLUTTER_URL \
  && mkdir -p $FLUTTER_HOME \
  && tar xf flutter.tar.xz -C /home/$USER \
  && rm flutter.tar.xz \
  && flutter config --no-analytics \
  && flutter precache \
  && yes "y" | flutter doctor --android-licenses \
  && flutter doctor \
  && flutter emulators --create \
  && flutter update-packages

RUN git clone https://github.com/Elite-Labs/EliteWallet.git /home/$USER/elite_wallet --branch main

WORKDIR /home/$USER/elite_wallet
RUN git config --global protocol.file.allow always \
  && git submodule update --init --force

WORKDIR /home/$USER/elite_wallet/scripts/android
RUN ./install_ndk.sh \
  && ./app_config.sh \
  && ./build_all.sh \
  && ./copy_monero_deps.sh

WORKDIR /home/$USER/
RUN keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key -noprompt -dname "CN=EliteWallet, OU=EliteWallet, O=EliteWallet, L=Florida, S=America, C=USA" -storepass adminadmin -keypass adminadmin

WORKDIR /home/$USER/elite_wallet
RUN bash ./scripts/build.sh
admin@ip-10-0-1-207:~/EliteWallet$ uname -a
Linux ip-10-0-1-207 6.1.0-13-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.55-1 (2023-09-29) x86_64 GNU/Linux
admin@ip-10-0-1-207:~/EliteWallet$ sudo docker --version
Docker version 26.0.2, build 3c863ff

build.log

@xrviv
Copy link
Author

xrviv commented Apr 26, 2024

built!

Edited. 2024-05-21

I tried building it again, but this time I only encounter build failures.

@xrviv
Copy link
Author

xrviv commented Jun 11, 2024

Using Chad's Dockerfile no longer builds: https://pastebin.com/cGknq5Y1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants