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

WIP: Reproducible Builds #535

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM openjdk:16-alpine3.13

RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
wget \
unzip \
openjdk-11-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 /olympus/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="/olympus/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 /olympus

RUN git clone --depth 1 https://github.com/ZeusLN/zeus.git
WORKDIR /olympus/zeus
RUN npm install

CMD /bin/bash
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="olympus_keystore.pass"
KEYSTORE_FILE="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;
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 ../";