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

Reproducible builds #1055

Merged
merged 17 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM reactnativecommunity/react-native-android:latest

WORKDIR /olympus

RUN git clone --depth 1 https://github.com/ZeusLN/zeus.git
WORKDIR /olympus/zeus
ktecho marked this conversation as resolved.
Show resolved Hide resolved
RUN npm install

CMD /bin/bash
40 changes: 40 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
set -x
PASS_FILE="android/app/olympus_keystore.pass"
KEYSTORE_FILE="android/app/olympus.pfx"
ALIAS="olympus"

ZEUS_PATH=/olympus/zeus

# 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;
keytool -genkeypair -alias $ALIAS -keystore $KEYSTORE_FILE -v -storetype PKCS12 -keyalg RSA -keysize 2048 -storepass $KEYSTORE_PASS -keypass $KEYSTORE_PASS -validity 10000
fi

ZEUS_KEY_PASSWORD=$ZEUS_STORE_PASSWORD

KEYSTORE_FILE="$ZEUS_PATH/$KEYSTORE_FILE"

docker build . -t zeus_builder_image

docker run --name zeus_builder_container -v `pwd`:$ZEUS_PATH zeus_builder_image bash -c \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to include flag --platform linux/amd64 or you'll hit an error on M1 systems

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UGH, performance is terrible via emulation. Need to get them to publish an arm64 image

react-native-community/docker-android#166

"cd /olympus/zeus/android && \
ZEUS_KEYSTORE_PATH=$KEYSTORE_FILE \
ZEUS_KEY_PASSWORD=$KEYSTORE_PASS \
ZEUS_STORE_PASSWORD=$KEYSTORE_PASS \
ZEUS_KEY_ALIAS=$ALIAS \
ZEUS_DEBUG_KEYSTORE_PATH=dummy \
ZEUS_DEBUG_STORE_PASSWORD=dummy \
ZEUS_DEBUG_KEY_ALIAS=dummy \
ZEUS_DEBUG_KEY_PASSWORD=dummy \
./gradlew assembleDebug && \
cp ./app/build/outputs/apk/debug/zeus-debug.apk ../";
47 changes: 47 additions & 0 deletions compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
set -x
PASS_FILE="android/app/olympus_keystore.pass"
KEYSTORE_FILE="android/app/olympus.pfx"
IMAGE_TAG_FILE="image.tag"
ALIAS="olympus"

ZEUS_PATH=/olympus/zeus


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;
keytool -genkeypair -alias $ALIAS -keystore $KEYSTORE_FILE -v -storetype PKCS12 -keyalg RSA -keysize 2048 -storepass $KEYSTORE_PASS -keypass $KEYSTORE_PASS -validity 10000
fi

ZEUS_KEY_PASSWORD=$ZEUS_STORE_PASSWORD

KEYSTORE_FILE="$ZEUS_PATH/$KEYSTORE_FILE"
docker run -v `pwd`:$ZEUS_PATH $IMAGETAG bash -c \
"cd /olympus/zeus/android && \
ZEUS_KEYSTORE_PATH=$KEYSTORE_FILE \
ZEUS_KEY_PASSWORD=$KEYSTORE_PASS \
ZEUS_STORE_PASSWORD=$KEYSTORE_PASS \
ZEUS_KEY_ALIAS=$ALIAS \
ZEUS_DEBUG_KEYSTORE_PATH=dummy \
ZEUS_DEBUG_STORE_PASSWORD=dummy \
ZEUS_DEBUG_KEY_ALIAS=dummy \
ZEUS_DEBUG_KEY_PASSWORD=dummy \
./gradlew assembleRelease && \
cp ./app/build/outputs/apk/release/app-release.apk ../";