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

Updates to Dockerfile. #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
80 changes: 58 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,72 @@
from ubuntu
from ubuntu:xenial

# Install basic tools
RUN apt-get update -y && apt-get install -y wget git zip
ARG ANDROID_COMPILE_SDK="28"
ARG ANDROID_BUILD_TOOLS="28.0.2"
ARG ANDROID_SDK_TOOLS="4333796"

# Add extra architectures
RUN dpkg --add-architecture i386 ; dpkg --add-architecture armhf ; dpkg --add-architecture arm64
RUN sed -i 's/deb http/deb [arch=amd64,i386] http/' /etc/apt/sources.list
RUN grep "ubuntu.com/ubuntu" /etc/apt/sources.list | tee /etc/apt/sources.list.d/ports.list
RUN sed -i 's/amd64,i386/armhf,arm64/' /etc/apt/sources.list.d/ports.list
RUN sed -i 's#http://.*/ubuntu#http://ports.ubuntu.com/ubuntu-ports#' /etc/apt/sources.list.d/ports.list
RUN apt -qq update

# Install java and basic tools
RUN apt-get update && apt-get install -y \
git \
curl \
ca-certificates \
wget \
bzip2 \
zip \
unzip \
xz-utils \
openjdk-8-jre-headless \
openjdk-8-jdk-headless \
maven \
ant \
gradle

# Install Native toolchain
RUN apt-get install -y make gcc g++ gcc-multilib g++-multilib g++-mingw-w64-i686 g++-mingw-w64-x86-64
RUN apt-get install -y make gcc g++ gcc-multilib g++-multilib g++-mingw-w64-i686 g++-mingw-w64-x86-64 ccache lib32stdc++6 lib32z1

# Install NDK
RUN mkdir /ndk && cd /ndk && wget https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip -O ndk.zip && unzip ndk.zip && rm ndk.zip
ENV NDK_HOME /ndk/android-ndk-r13b
# Install arm toolchains
RUN apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf gcc-aarch64-linux-gnu g++-aarch64-linux-gnu

# Install Java
RUN apt-get install -y openjdk-8-jre openjdk-8-jdk ant
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
# Install misc i386 deps (libstdc++-6-dev:i386 on Stretch/Bionic)
RUN apt-get install -y libstdc++-5-dev:i386

# Install x11 deps for gdx-controllers
RUN apt-get install -y libx11-dev libx11-dev:i386 libx11-dev:armhf libx11-dev:arm64

# Install LibGDX tools
RUN mkdir /libgdx
WORKDIR /libgdx
# Enable ccache
ENV PATH="/usr/lib/ccache:${PATH}"

# Download packr openjdk images
RUN wget https://bitbucket.org/alexkasko/openjdk-unofficial-builds/downloads/openjdk-1.7.0-u80-unofficial-macosx-x86_64-image.zip
RUN wget https://bitbucket.org/alexkasko/openjdk-unofficial-builds/downloads/openjdk-1.7.0-u80-unofficial-windows-amd64-image.zip
RUN wget https://bitbucket.org/alexkasko/openjdk-unofficial-builds/downloads/openjdk-1.7.0-u80-unofficial-linux-amd64-image.zip
RUN mkdir -p /opt/android-sdk-linux
RUN wget -q https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip -O android-sdk.zip
RUN unzip -q -d /opt/android-sdk-linux android-sdk.zip
RUN rm android-sdk.zip
ENV ANDROID_HOME=/opt/android-sdk-linux
ENV PATH="/opt/android-sdk-linux/platform-tools/:${PATH}"

# Download packr.jar
RUN wget http://libgdx.badlogicgames.com/packr/packr.jar
RUN echo y | /opt/android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
RUN echo y | /opt/android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
RUN echo y | /opt/android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
RUN yes | /opt/android-sdk-linux/tools/bin/sdkmanager --licenses

# Install NDK
RUN mkdir -p /opt/android-sdk-linux/ndk
RUN wget -q https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip -O ndk.zip
RUN unzip -q -d /opt/android-sdk-linux/ndk ndk.zip
RUN rm ndk.zip
ENV NDK_HOME=/opt/android-sdk-linux/ndk/android-ndk-r16b
ENV PATH="/opt/android-sdk-linux/ndk/android-ndk-r16b:${PATH}"

# Install scripts
COPY ./scripts/ /usr/bin/
# Enable ccache for ndk
ENV NDK_CCACHE=/usr/bin/ccache

# Boot in /work directory
VOLUME /work
WORKDIR /work
WORKDIR /work

15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ This image provides all what you need in order to :
* Build native code for some LibGDX supported platforms (all exept MacOSX and iOS).

This image contains :
* Packr : LibGDX application packager tool.
* some java distributions from https://bitbucket.org/alexkasko
* Native toolchain (GCC, MinGW, NDK)
* OpenJDK-8
* Maven
* Gradle
* Ant
* Android SDK
* Native toolchain (GCC, MinGW, NDK, Linux armhf/aarch64)
* ccache enabled for all native toolchains

# How to use this image

Expand All @@ -20,7 +24,4 @@ To run a docker container in your current directory (eg. your LibGDX project dir

This will run a new container binding current folder to container work folder.

Once in container, you can run for instance `./gradlew build`

Some provided scripts are available in PATH :
* packr
Once in container, you can run for instance `./gradlew build`
3 changes: 0 additions & 3 deletions scripts/packr

This file was deleted.