Skip to content

Commit

Permalink
Add documentation and fix build directory permission issues
Browse files Browse the repository at this point in the history
  • Loading branch information
takenagain committed May 21, 2024
1 parent a6f0fc3 commit 93dfbaa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
35 changes: 16 additions & 19 deletions .docker/android-apk-build.dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
FROM ubuntu:latest as build
FROM --platform=linux/amd64 ubuntu:latest as build

RUN apt update && apt upgrade -y && apt install -y python3 python3-pip git curl nodejs python3-venv && \
mkdir -p /home/mobiledevops/komodo-wallet-mobile
RUN apt update && \
apt upgrade -y && \
apt install -y python3 python3-pip git curl nodejs python3-venv && \
mkdir -p /app

WORKDIR /home/mobiledevops/komodo-wallet-mobile
WORKDIR /app

# TODO: add .dockerignore
COPY . .

# TODO: add .gitkeep files for the missing directories
RUN curl -o assets/coins.json https://raw.githubusercontent.com/KomodoPlatform/coins/master/coins && \
curl -o assets/coins_config.json https://raw.githubusercontent.com/KomodoPlatform/coins/master/utils/coins_config.json && \
mkdir -p android/app/src/main/cpp/libs/armeabi-v7a && \
Expand All @@ -15,36 +19,29 @@ RUN curl -o assets/coins.json https://raw.githubusercontent.com/KomodoPlatform/c
.venv/bin/pip install -r .docker/requirements.txt && \
.venv/bin/python .docker/update_api.py --force

FROM mobiledevops/android-sdk-image:34.0.0-jdk17 as final
FROM --platform=linux/amd64 ghcr.io/cirruslabs/android-sdk:34 as final

ENV FLUTTER_VERSION="2.8.1"
ENV FLUTTER_HOME "/home/mobiledevops/.flutter-sdk"
ENV USER="mobiledevops"
ENV FLUTTER_HOME "/home/komodo/.flutter-sdk"
ENV USER="komodo"
ENV PATH $PATH:$FLUTTER_HOME/bin

# Download and extract Flutter SDK
RUN mkdir $FLUTTER_HOME \
RUN mkdir -p $FLUTTER_HOME \
&& git config --global --add safe.directory /home/komodo/.flutter-sdk \
&& cd $FLUTTER_HOME \
&& curl --fail --remote-time --silent --location -O https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz \
&& tar xf flutter_linux_${FLUTTER_VERSION}-stable.tar.xz --strip-components=1 \
&& rm flutter_linux_${FLUTTER_VERSION}-stable.tar.xz

ENV ANDROID_HOME "/opt/android-sdk-linux"
ENV ANDROID_SDK_ROOT $ANDROID_HOME
ENV PATH $PATH:$ANDROID_HOME/cmdline-tools:$ANDROID_HOME/cmdline-tools/bin:$ANDROID_HOME/platform-tools

RUN $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_ROOT} --update && \
sdkmanager --install "cmdline-tools;latest" --sdk_root=${ANDROID_SDK_ROOT} && \
sdkmanager --install "platform-tools" --sdk_root=${ANDROID_SDK_ROOT}

RUN flutter config --no-analytics --android-sdk=$ANDROID_HOME \
RUN flutter config --no-analytics \
&& flutter precache \
&& yes "y" | flutter doctor --android-licenses \
&& flutter doctor \
&& flutter update-packages

COPY --from=build --chown=$USER:$USER /home/mobiledevops/komodo-wallet-mobile /home/mobiledevops/komodo-wallet-mobile
COPY --from=build /app /app

WORKDIR /home/$USER/komodo-wallet-mobile
WORKDIR /app

CMD [ "flutter", "build", "apk", "--release" ]
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ Windows: `choco install jq`, [Choco software](https://chocolatey.org/)

https://github.com/KomodoPlatform/AtomicDEX-mobile/wiki/Project-Setup#build-and-run

### Build with docker

To build from a container without installing Flutter on an x86_64 machine (Linux or Windows) with Docker or Podman installed, you can use the provided Dockerfile.

```bash
docker build -f .docker/android-apk-build.dockerfile . -t mobile_apk_build
docker run --rm -u 1001:1001 -v ./build:/app/build mobile_apk_build:latest
```

## Run/Build with screenshot and video recording ON

Expand Down

0 comments on commit 93dfbaa

Please sign in to comment.