FROM python:3-slim LABEL maintainer="Drew Short " ARG RENPY_VERSION ENV SDL_AUDIODRIVER="dummy" \ SDL_VIDEODRIVER="dummy" \ RENPY_DIR="/renpy" \ RENPY_VERSION=${RENPY_VERSION:-"7.3.5"} \ JDK_VERSION=${JDK_VERSION:-"8u242"} \ JDK_BUILD=${JDK_BUILD:-"b08"} \ JAVA_HOME=${JAVA_HOME:-/opt/java} \ ANDROID_SDK_VERSION=${ANDROID_SDK_VERSION:-"sdk-tools-linux-4333796"} \ ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT:-"/renpy/rapt/Sdk"} \ ANDROID_HOME=${ANDROID_SDK_ROOT} \ PATH="$PATH:${JAVA_HOME:-/opt/java}/bin" # Temp directory and volume mount RUN mkdir -p /tmp /project # The default expected volume to work with the Ren'Py project VOLUME /project # Install required tooling RUN apt-get -y update \ && apt-get -y --no-install-recommends install \ procps \ bzip2 \ ca-certificates \ curl \ jq \ tar \ unzip \ wget \ && rm -Rf /var/lib/apt/lists/* # Install Java 8 RUN cd /tmp \ && curl -LSo jdk${JDK_VERSION}-${JDK_BUILD}.tgz https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk${JDK_VERSION}-${JDK_BUILD}/OpenJDK8U-jdk_x64_linux_hotspot_${JDK_VERSION}${JDK_BUILD}.tar.gz \ && tar -zxf jdk${JDK_VERSION}-${JDK_BUILD}.tgz \ && mkdir -p ${JAVA_HOME} \ && mv ./jdk${JDK_VERSION}-${JDK_BUILD}/* "${JAVA_HOME}" \ && rm -rf "jdk${JDK_VERSION}-${JDK_BUILD}" "${JDK_VERSION}-${JDK_BUILD}.tgz" # Install RenPy RUN cd /tmp \ && curl -LSo renpy-${RENPY_VERSION}-sdk.tar.bz2 https://www.renpy.org/dl/${RENPY_VERSION}/renpy-${RENPY_VERSION}-sdk.tar.bz2 \ && curl -LSo renpy-${RENPY_VERSION}-rapt.zip https://www.renpy.org/dl/${RENPY_VERSION}/renpy-${RENPY_VERSION}-rapt.zip \ && curl -LSo renpy-${RENPY_VERSION}-web.zip https://www.renpy.org/dl/${RENPY_VERSION}/renpy-${RENPY_VERSION}-web.zip \ && tar -xf renpy-${RENPY_VERSION}-sdk.tar.bz2 \ && rm renpy-${RENPY_VERSION}-sdk.tar.bz2 \ && mv renpy-${RENPY_VERSION}-sdk ${RENPY_DIR} \ && unzip renpy-${RENPY_VERSION}-rapt.zip -d ${RENPY_DIR} \ && rm renpy-${RENPY_VERSION}-rapt.zip \ && unzip renpy-${RENPY_VERSION}-web.zip -d ${RENPY_DIR} \ && rm renpy-${RENPY_VERSION}-web.zip # Export a basic configuration for the build RUN printf "key.alias=android\nkey.store.password=android\nkey.alias.password=android\nkey.store=${RENPY_DIR}/rapt/android.keystore\nsdk.dir=${ANDROID_SDK_ROOT}\n" > ${RENPY_DIR}/rapt/prototype/local.properties \ && mkdir -p ${RENPY_DIR}/rapt/project \ && cp ${RENPY_DIR}/rapt/prototype/local.properties ${RENPY_DIR}/rapt/project/local.properties # Install the Android SDK for rapt RUN cd /tmp \ && curl -LSo ${ANDROID_SDK_VERSION}.zip https://dl.google.com/android/repository/${ANDROID_SDK_VERSION}.zip \ && unzip ${ANDROID_SDK_VERSION}.zip -d ./${ANDROID_SDK_VERSION} \ && mkdir -p ${ANDROID_SDK_ROOT} \ && mv ./${ANDROID_SDK_VERSION}/* ${ANDROID_SDK_ROOT} \ && rm -rf ./${ANDROID_SDK_VERSION} ${ANDROID_SDK_VERSION}.zip # Accept the Android SDK licenses and install the required tooling RUN cd ${ANDROID_SDK_ROOT} \ && yes y | tools/bin/sdkmanager --licenses \ && yes y | tools/bin/sdkmanager "platforms;android-28" \ && yes y | tools/bin/sdkmanager "build-tools;27.0.3" # Precache gradle RUN cd ${RENPY_DIR}/rapt/prototype \ && ./gradlew --version WORKDIR $RENPY_DIR