7
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-06-10 17:52:20 +00:00

🤖 1-click android app building

TODO: README
This commit is contained in:
Régis Behmo 2018-05-27 15:29:14 -04:00
parent f5a407cae7
commit 71912293a1
11 changed files with 97 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
.*.swp .*.swp
config/openedx/*.json config/openedx/*.json
config/nginx/*.conf config/nginx/*.conf
config/android/*.yaml
mysql/config/database mysql/config/database
mysql/config/username mysql/config/username
mysql/config/password mysql/config/password

View File

@ -1,4 +1,4 @@
.PHONY: all configure build update migrate assets up daemon .PHONY: all android configure build update migrate assets up daemon
USERID ?= $$(id -u) USERID ?= $$(id -u)
EDX_PLATFORM_SETTINGS ?= universal.production EDX_PLATFORM_SETTINGS ?= universal.production
@ -67,6 +67,23 @@ cms-shell:
$(DOCKER_COMPOSE_RUN_OPENEDX) cms ./manage.py cms shell $(DOCKER_COMPOSE_RUN_OPENEDX) cms ./manage.py cms shell
#################### Android app
android:
docker-compose -f docker-compose-android.yml run --rm android
@echo "Your APK file is ready: ./data/android/edx-prod-debuggable-2.14.0.apk"
android-release:
# Note that this requires that you edit ./config/android/gradle.properties
docker-compose -f docker-compose-android.yml run --rm android ./gradlew assembleProdRelease
android-build:
docker build -t regis/openedx-android:latest android/
android-push:
docker push regis/openedx-android:latest
android-dockerhub: android-build android-push
#################### Deploying to docker hub #################### Deploying to docker hub
build: build:

View File

@ -115,6 +115,19 @@ Open a python shell in the lms or the cms:
make cms-shell make cms-shell
## Android app (beta)
The Android app for your platform can be easily built in just one command:
make android
If all goes well, the debuggable APK for your platform should then be available in ./data/android. To obtain a release APK, you will need to obtain credentials from the app store and add them to `config/android/gradle.properties`. The, run:
make android-release
Building the Android app for an Open edX platform is currently labeled as a **beta feature** because it was not fully tested yet. In particular, there is no easy mechanism for overriding the edX assets in the mobile app. This is still a work-in-progress.
## For developers ## For developers
In addition to running Open edX in production, you can use the docker containers for local development. This means you can hack on Open edX without setting up a Virtual Machine. Essentially, this replaces the devstack provided by edX. In addition to running Open edX in production, you can use the docker containers for local development. This means you can hack on Open edX without setting up a Virtual Machine. Essentially, this replaces the devstack provided by edX.

33
android/Dockerfile Normal file
View File

@ -0,0 +1,33 @@
FROM ubuntu:16.04
RUN apt update && \
apt upgrade -y && \
apt install -y wget unzip git default-jre default-jdk
RUN mkdir /openedx
# Install Android SDK
# Inspired from https://github.com/LiveXP/docker-android-sdk/blob/master/Dockerfile
ENV ANDROID_SDK_VERSION 3859397
ENV ANDROID_SDK_PATH /openedx/android-sdk
ENV ANDROID_HOME /openedx/android-sdk
RUN mkdir /openedx/android-sdk
WORKDIR /openedx/android-sdk
RUN wget https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_VERSION}.zip && \
unzip sdk-tools-linux-${ANDROID_SDK_VERSION}.zip && \
rm sdk-tools-linux-${ANDROID_SDK_VERSION}.zip
# Install android app repo
RUN git clone https://github.com/edx/edx-app-android /openedx/edx-app-android
WORKDIR /openedx/edx-app-android
# User-customized config
COPY ./edx.properties ./OpenEdXMobile/edx.properties
RUN mkdir /openedx/config
RUN ln -s /openedx/config/gradle.properties ./OpenEdXMobile/gradle.properties
# Accept licenses
RUN yes | /openedx/android-sdk/tools/bin/sdkmanager --licenses
CMD ./gradlew assembleProdDebuggable && \
cp OpenEdXMobile/build/outputs/apk/*.apk /openedx/data/

1
android/edx.properties Normal file
View File

@ -0,0 +1 @@
edx.dir = '/openedx/config'

View File

@ -0,0 +1,3 @@
edx.android {
configFiles = ['universal.yaml']
}

View File

@ -0,0 +1,5 @@
APPLICATION_ID=com.example.yourapp
RELEASE_STORE_FILE=/openedx/config/your.keystore
RELEASE_STORE_PASSWORD=your store password here
RELEASE_KEY_PASSWORD=your key password here
RELEASE_KEY_ALIAS=your key alias here

View File

@ -0,0 +1,5 @@
API_HOST_URL: 'http://${LMS_HOST}'
ENVIRONMENT_DISPLAY_NAME: 'universal'
PLATFORM_NAME: '${PLATFORM_NAME}'
PLATFORM_DESTINATION_NAME: '${LMS_HOST}'
FEEDBACK_EMAIL_ADDRESS: 'support@${LMS_HOST}'

7
configure vendored
View File

@ -189,6 +189,13 @@ def main():
delimiter='£', **configurator.as_dict() delimiter='£', **configurator.as_dict()
) )
# Android
substitute(
os.path.join('config', 'android', 'templates', 'universal.yaml.templ'),
os.path.join('config', 'android', 'universal.yaml'),
**configurator.as_dict()
)
print("\nConfiguration files were successfuly generated. You may now run the app containers.") print("\nConfiguration files were successfuly generated. You may now run the app containers.")

1
data/.gitignore vendored
View File

@ -1,3 +1,4 @@
android/
cms/ cms/
cms_worker/ cms_worker/
lms/ lms/

View File

@ -0,0 +1,10 @@
version: "3"
services:
android:
image: regis/openedx-android:latest
build:
context: ./android
volumes:
- ./config/android/:/openedx/config/
- ./data/android/:/openedx/data