Skip to content

Commit

Permalink
Make JAVA_HOME platform independent
Browse files Browse the repository at this point in the history
  • Loading branch information
thyrlian committed Jan 14, 2024
1 parent 0cd9582 commit 613e72f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion android-sdk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ RUN mkdir -p ${ANDROID_HOME}/cmdline-tools && \
rm *tools*linux*.zip

# set the environment variables
ENV JAVA_HOME /usr/lib/jvm/java-${JDK_VERSION}-openjdk-amd64
RUN JAVA_HOME=$(ls -d /usr/lib/jvm/java-${JDK_VERSION}-openjdk-* | head -n 1) && \
echo "export JAVA_HOME=$JAVA_HOME" > /tmp/java_home.sh
ENV GRADLE_HOME /opt/gradle
ENV KOTLIN_HOME /opt/kotlinc
ENV PATH ${PATH}:${GRADLE_HOME}/bin:${KOTLIN_HOME}/bin:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/cmdline-tools/tools/bin:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/emulator
Expand Down Expand Up @@ -93,5 +94,9 @@ RUN apt-get update && \
done && \
(rm /tmp/*.pub 2> /dev/null || true)

ADD entrypoint.sh /tmp/entrypoint.sh
RUN chmod +x /tmp/entrypoint.sh
ENTRYPOINT ["/tmp/entrypoint.sh"]

ADD supervisord.conf /etc/supervisor/conf.d/
CMD ["/usr/bin/supervisord"]
7 changes: 7 additions & 0 deletions android-sdk/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

if [ -f /tmp/java_home.sh ]; then
source /tmp/java_home.sh
fi

exec "$@"

0 comments on commit 613e72f

Please sign in to comment.