Skip to content

Commit

Permalink
Move API build to postAttach event of devcontainer
Browse files Browse the repository at this point in the history
API was built in image to reduce Codespaces startup time, but ended up increasing the already large image size
  • Loading branch information
takenagain committed Jun 1, 2024
1 parent 1753e65 commit 2aa8459
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
18 changes: 5 additions & 13 deletions .docker/android-dev.dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM docker.io/ubuntu:22.04

LABEL Author "Onur Özkan <onur@komodoplatform.com>"
ARG KDF_BRANCH=main
ENV KDF_DIR=/kdf

Expand Down Expand Up @@ -128,22 +127,17 @@ RUN PATH="$HOME/.cargo/bin:$PATH" && \
else \
echo "Unsupported architecture"; \
exit 1; \
fi && \
cd $KDF_DIR && \
export PATH="$HOME/.cargo/bin:$PATH" && \
export PATH=$PATH:/android-ndk/bin && \
CC_aarch64_linux_android=aarch64-linux-android21-clang CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android21-clang cargo rustc --target=aarch64-linux-android --lib --release --crate-type=staticlib --package mm2_bin_lib && \
CC_armv7_linux_androideabi=armv7a-linux-androideabi21-clang CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi21-clang cargo rustc --target=armv7-linux-androideabi --lib --release --crate-type=staticlib --package mm2_bin_lib && \
mv target/aarch64-linux-android/release/libmm2lib.a target/aarch64-linux-android/release/libmm2.a &&\
mv target/armv7-linux-androideabi/release/libmm2lib.a target/armv7-linux-androideabi/release/libmm2.a
fi

RUN set -e -o xtrace \
&& cd /opt \
&& sudo chown -R $USER:$USER /opt \
&& sudo apt-get update \
&& sudo apt-get install -y jq \
openjdk-17-jdk \
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 \
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
libxtst6 libnss3-dev libnspr4 libxss1 libatk-bridge2.0-0 libgtk-3-0 libgdk-pixbuf2.0-0 \
&& sudo rm -rf /var/lib/apt/lists/* \
Expand All @@ -162,9 +156,7 @@ RUN set -e -o xtrace \
&& git config --global user.name "Komodo Platform" \
&& yes | sdkmanager \
"platforms;android-$ANDROID_PLATFORM_VERSION" \
"build-tools;$ANDROID_BUILD_TOOLS_VERSION" \
&& yes | sdkmanager "ndk;$ANDROID_NDK_VERSION"

"build-tools;$ANDROID_BUILD_TOOLS_VERSION"

RUN git clone https://github.com/flutter/flutter.git ${FLUTTER_HOME} \
&& cd ${FLUTTER_HOME} \
Expand Down
14 changes: 11 additions & 3 deletions .docker/dev-setup.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
sudo chmod -R u+rwx,g+rwx /home/komodo/workspace
sudo chown -R /home/komodo/workspace
sudo chown -R komodo:komodo /home/komodo/workspace
flutter pub get

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
mkdir -p android/app/src/main/cpp/libs/arm64-v8a

cp /kdf/target/aarch64-linux-android/release/libmm2.a android/app/src/main/cpp/libs/arm64-v8a
cp /kdf/target/armv7-linux-androideabi/release/libmm2.a android/app/src/main/cpp/libs/armeabi-v7a
cd /kdf
export PATH="$HOME/.cargo/bin:$PATH"
export PATH=$PATH:/android-ndk/bin
CC_aarch64_linux_android=aarch64-linux-android21-clang CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android21-clang cargo rustc --target=aarch64-linux-android --lib --release --crate-type=staticlib --package mm2_bin_lib
CC_armv7_linux_androideabi=armv7a-linux-androideabi21-clang CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi21-clang cargo rustc --target=armv7-linux-androideabi --lib --release --crate-type=staticlib --package mm2_bin_lib
mv target/aarch64-linux-android/release/libmm2lib.a target/aarch64-linux-android/release/libmm2.a
mv target/armv7-linux-androideabi/release/libmm2lib.a target/armv7-linux-androideabi/release/libmm2.a

mv /kdf/target/aarch64-linux-android/release/libmm2.a /home/komodo/workspace/android/app/src/main/cpp/libs/arm64-v8a/libmm2.a
mv /kdf/target/armv7-linux-androideabi/release/libmm2.a /home/komodo/workspace/android/app/src/main/cpp/libs/armeabi-v7a/libmm2.a

0 comments on commit 2aa8459

Please sign in to comment.