xgo/docker/base/Dockerfile

87 lines
3.0 KiB
Docker
Raw Normal View History

# Go cross compiler (xgo): Base cross-compilation layer
# Copyright (c) 2014 Péter Szilágyi. All rights reserved.
#
# Released under the MIT license.
FROM ubuntu:14.04
MAINTAINER Péter Szilágyi <peterke@gmail.com>
# Configure the Go environment, since it's not going to change
ENV PATH /usr/local/go/bin:$PATH
ENV GOPATH /go
# Inject the remote file fetcher and checksum verifier
ADD fetch.sh /fetch.sh
ENV FETCH /fetch.sh
RUN chmod +x $FETCH
# Make sure apt-get is up to date and dependent packages are installed
RUN \
apt-get update && \
2015-09-11 09:26:49 +00:00
apt-get install -y automake autogen build-essential ca-certificates \
gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libc6-dev-armel-cross \
gcc-multilib g++-multilib gcc-mingw-w64 g++-mingw-w64 clang llvm-dev \
libtool libxml2-dev uuid-dev libssl-dev pkg-config patch make xz-utils \
cpio wget unzip p7zip git mercurial bzr --no-install-recommends
# Configure the container for OSX cross compilation
ENV OSX_SDK_PATH https://github.com/trevd/android_platform_build2/raw/master/osxsdks10.6.tar.gz
ENV OSX_SDK MacOSX10.6.sdk
RUN \
git clone https://github.com/tpoechtrager/osxcross.git && \
\
2015-09-11 09:26:49 +00:00
$FETCH $OSX_SDK_PATH f526b4ae9806e8d31e3b094e3f004f8f160a3fad && \
tar -xzf `basename $OSX_SDK_PATH` --strip-components 1 SDKs/$OSX_SDK && \
tar -cjf /osxcross/tarballs/$OSX_SDK.tar.bz2 $OSX_SDK && \
rm -rf `basename $OSX_SDK_PATH` $OSX_SDK && \
\
UNATTENDED=yes /osxcross/build.sh
2015-09-11 09:26:49 +00:00
2015-05-04 07:38:10 +00:00
ENV PATH /osxcross/target/bin:$PATH
2015-09-11 09:26:49 +00:00
# Configure the container for Android cross compilation
ENV ANDROID_NDK android-ndk-r10e
ENV ANDROID_NDK_PATH http://dl.google.com/android/ndk/$ANDROID_NDK-linux-x86_64.bin
ENV ANDROID_NDK_ROOT /usr/local/$ANDROID_NDK
ENV ANDROID_PLATFORM 21
ENV ANDROID_CHAIN_ARM arm-linux-androideabi-4.9
2015-09-11 09:26:49 +00:00
RUN \
$FETCH $ANDROID_NDK_PATH c685e5f106f8daa9b5449d0a4f21ee8c0afcb2f6 && \
7zr x `basename $ANDROID_NDK_PATH` \
"$ANDROID_NDK/build" \
"$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/include" \
"$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi*" \
"$ANDROID_NDK/prebuilt/linux-x86_64" \
"$ANDROID_NDK/platforms/*/arch-arm" \
"$ANDROID_NDK/toolchains/$ANDROID_CHAIN_ARM" -o/usr/local > /dev/null && \
rm -f `basename $ANDROID_NDK_PATH`
ENV PATH /usr/$ANDROID_CHAIN_ARM/bin:$PATH
# Inject the old Go package downloader and tool-chain bootstrapper
ADD bootstrap.sh /bootstrap.sh
ENV BOOTSTRAP /bootstrap.sh
RUN chmod +x $BOOTSTRAP
# Inject the new Go root distribution downloader and secondary bootstrapper
ADD bootstrap_pure.sh /bootstrap_pure.sh
ENV BOOTSTRAP_PURE /bootstrap_pure.sh
RUN chmod +x $BOOTSTRAP_PURE
# Inject the C dependency cross compiler
ADD build_deps.sh /build_deps.sh
ENV BUILD_DEPS /build_deps.sh
RUN chmod +x $BUILD_DEPS
# Inject the container entry point, the build script
ADD build.sh /build.sh
ENV BUILD /build.sh
RUN chmod +x $BUILD
ENTRYPOINT ["/build.sh"]