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
easy script for self building #74
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FROM ubuntu:18.04 | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
git \ | ||
curl \ | ||
wget \ | ||
unzip \ | ||
openjdk-8-jdk && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl -sL https://deb.nodesource.com/setup_13.x | bash - && \ | ||
apt-get update && apt-get install -y --no-install-recommends nodejs \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /magen/sdk | ||
RUN wget https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip && \ | ||
unzip commandlinetools-linux-6200805_latest.zip && \ | ||
rm commandlinetools-linux-6200805_latest.zip | ||
|
||
ENV ANDROID_SDK_ROOT="/magen/sdk" | ||
ENV ANDROID_HOME="${ANDROID_SDK_ROOT}" | ||
ENV PATH="${PATH}:${ANDROID_HOME}/emulator" | ||
ENV PATH="${PATH}:${ANDROID_HOME}/tools" | ||
ENV PATH="${PATH}:${ANDROID_HOME}/tools/bin" | ||
ENV PATH="${PATH}:${ANDROID_HOME}/platform-tools" | ||
|
||
RUN yes | $ANDROID_HOME/tools/bin/sdkmanager --sdk_root=${ANDROID_HOME} --licenses | ||
RUN $ANDROID_HOME/tools/bin/sdkmanager --sdk_root=${ANDROID_HOME} --update | ||
RUN $ANDROID_HOME/tools/bin/sdkmanager --sdk_root=${ANDROID_HOME} "platform-tools" "platforms;android-28" | ||
|
||
WORKDIR /magen | ||
|
||
RUN git clone --depth 1 https://github.com/MohGovIL/hamagen-react-native.git | ||
WORKDIR /magen/hamagen-react-native | ||
RUN npm install | ||
RUN cd android && ./gradlew | true 2>/dev/null | ||
|
||
CMD /bin/bash |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
set -x | ||
PASS_FILE="magen_keystore.pass" | ||
KEYSTORE_FILE="magen.pfx" | ||
IMAGE_TAG_FILE="image.tag" | ||
ALIAS="magen" | ||
|
||
GUES_PATH=/magen/hamagen-react-native | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo from GUEST :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Notify me once you push and I'll resolve |
||
|
||
|
||
if [ -f $IMAGE_TAG_FILE ]; then | ||
IMAGETAG=$(cat $IMAGE_TAG_FILE); | ||
else | ||
IMAGETAG=$(head -c 12 /dev/urandom | sha256sum | head -c 12); | ||
docker build . -t $IMAGETAG | ||
echo $IMAGETAG > $IMAGE_TAG_FILE; | ||
fi | ||
|
||
# Check we have the password. | ||
if [ -f $PASS_FILE ]; then | ||
KEYSTORE_PASS=$(cat magen_keystore.pass); | ||
else | ||
KEYSTORE_PASS=$(head -c 32 /dev/urandom | sha256sum | head -c 64); | ||
echo $KEYSTORE_PASS > $PASS_FILE; | ||
fi | ||
|
||
# Check we have the keystore. | ||
|
||
if [ ! -f $KEYSTORE_FILE ]; then | ||
keytool -genkey -alias $ALIAS -keystore $KEYSTORE_FILE -storetype PKCS12 -keyalg RSA -keysize 4096 -storepass $KEYSTORE_PASS -keypass $KEYSTORE_PASS -validity 10000 -dname CN=IL; | ||
fi | ||
|
||
HAMAGEN_KEY_PASSWORD=$HAMAGEN_STORE_PASSWORD | ||
|
||
KEYSTORE_FILE="$GUES_PATH/$KEYSTORE_FILE" | ||
docker run -v `pwd`:$GUES_PATH $IMAGETAG bash -c \ | ||
"cd ./android && \ | ||
HAMAGEN_KEYSTORE_PATH=$KEYSTORE_FILE \ | ||
HAMAGEN_KEY_PASSWORD=$KEYSTORE_PASS \ | ||
HAMAGEN_STORE_PASSWORD=$KEYSTORE_PASS \ | ||
HAMAGEN_KEY_ALIAS=$ALIAS \ | ||
HAMAGEN_DEBUG_KEYSTORE_PATH=dummy \ | ||
HAMAGEN_DEBUG_STORE_PASSWORD=dummy \ | ||
HAMAGEN_DEBUG_KEY_ALIAS=dummy \ | ||
HAMAGEN_DEBUG_KEY_PASSWORD=dummy \ | ||
./gradlew assembleRelease && \ | ||
cp ./app/build/outputs/apk/release/app-release.apk ../"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use
alpine
andapk
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this was prototyping to allow myself to compile the apk so I won't need to install from the google play and I could skip one trust hop.
I didn't put too much effort into improving this afterwards because I wasn't sure if you guys are even interested. if you are I can do that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not part of the team 🙌 so I can't really approve in their name.
Just wanted to start contributing by helping with open PRs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regardless, alpine is 10 times lighter than ubuntu which is pretty optimal for creating containers