mirror of
https://github.com/status-im/xgo.git
synced 2025-01-11 19:34:55 +00:00
Split dockerfile into base and release layers.
This commit is contained in:
parent
9ad0388ef3
commit
607e6ee0af
131
docker/base/Dockerfile
Normal file
131
docker/base/Dockerfile
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
# 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>
|
||||||
|
|
||||||
|
# Create a small script to download binaries and validate their checksum
|
||||||
|
ENV FETCH ./fetch.sh
|
||||||
|
RUN \
|
||||||
|
echo '#!/bin/bash' > $FETCH && \
|
||||||
|
echo 'set -e' >> $FETCH && \
|
||||||
|
echo 'file=`basename $1`' >> $FETCH && \
|
||||||
|
echo 'echo "Downloading $1..."' >> $FETCH && \
|
||||||
|
echo 'wget -q $1' >> $FETCH && \
|
||||||
|
echo 'echo "$2 $file" > $file.sum' >> $FETCH && \
|
||||||
|
echo 'sha1sum -c $file.sum' >> $FETCH && \
|
||||||
|
echo 'rm $file.sum' >> $FETCH && \
|
||||||
|
chmod +x $FETCH
|
||||||
|
|
||||||
|
|
||||||
|
# Make sure apt-get is up to date and dependent packages are installed
|
||||||
|
RUN \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install -y automake autogen build-essential ca-certificates \
|
||||||
|
gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-multilib gcc-mingw-w64 \
|
||||||
|
clang llvm-dev libtool libxml2-dev uuid-dev libssl-dev patch make \
|
||||||
|
xz-utils cpio wget unzip git mercurial --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 && \
|
||||||
|
sed -i.bak s/read/#read/g /osxcross/build.sh && \
|
||||||
|
\
|
||||||
|
$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 && \
|
||||||
|
\
|
||||||
|
/osxcross/build.sh
|
||||||
|
|
||||||
|
|
||||||
|
# Create a small script to download all the Go packages, install the core Linux
|
||||||
|
# package, inject and bootstrap the others
|
||||||
|
ENV BOOTSTRAP ./bootstrap.sh
|
||||||
|
RUN \
|
||||||
|
echo '#!/bin/bash' > $BOOTSTRAP && \
|
||||||
|
echo 'set -e' >> $BOOTSTRAP && \
|
||||||
|
echo >> $BOOTSTRAP && \
|
||||||
|
echo '$FETCH $DIST_LINUX_64 $DIST_LINUX_64_SHA1' >> $BOOTSTRAP && \
|
||||||
|
echo '$FETCH $DIST_LINUX_32 $DIST_LINUX_32_SHA1' >> $BOOTSTRAP && \
|
||||||
|
echo '$FETCH $DIST_LINUX_ARM $DIST_LINUX_ARM_SHA1' >> $BOOTSTRAP && \
|
||||||
|
echo '$FETCH $DIST_OSX_64 $DIST_OSX_64_SHA1' >> $BOOTSTRAP && \
|
||||||
|
echo '$FETCH $DIST_OSX_32 $DIST_OSX_32_SHA1' >> $BOOTSTRAP && \
|
||||||
|
echo '$FETCH $DIST_WIN_64 $DIST_WIN_64_SHA1' >> $BOOTSTRAP && \
|
||||||
|
echo '$FETCH $DIST_WIN_32 $DIST_WIN_32_SHA1' >> $BOOTSTRAP && \
|
||||||
|
echo >> $BOOTSTRAP && \
|
||||||
|
echo 'tar -C /usr/local -xzf `basename $DIST_LINUX_64`' >> $BOOTSTRAP && \
|
||||||
|
echo 'rm -rf /usr/local/go/pkg/linux_amd64_race' >> $BOOTSTRAP && \
|
||||||
|
echo >> $BOOTSTRAP && \
|
||||||
|
echo 'tar -C /usr/local --wildcards -xzf `basename $DIST_LINUX_32` go/pkg/linux_386' >> $BOOTSTRAP && \
|
||||||
|
echo 'GOOS=linux GOARCH=386 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap' >> $BOOTSTRAP && \
|
||||||
|
echo 'tar -C /usr/local --wildcards -xzf `basename $DIST_LINUX_ARM` go/pkg/linux_arm' >> $BOOTSTRAP && \
|
||||||
|
echo 'GOOS=linux GOARCH=arm /usr/local/go/pkg/tool/linux_amd64/dist bootstrap' >> $BOOTSTRAP && \
|
||||||
|
echo >> $BOOTSTRAP && \
|
||||||
|
echo 'tar -C /usr/local --wildcards -xzf `basename $DIST_OSX_64` go/pkg/darwin_amd64' >> $BOOTSTRAP && \
|
||||||
|
echo 'GOOS=darwin GOARCH=amd64 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap' >> $BOOTSTRAP && \
|
||||||
|
echo 'tar -C /usr/local --wildcards -xzf `basename $DIST_OSX_32` go/pkg/darwin_386' >> $BOOTSTRAP && \
|
||||||
|
echo 'GOOS=darwin GOARCH=386 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap' >> $BOOTSTRAP && \
|
||||||
|
echo >> $BOOTSTRAP && \
|
||||||
|
echo 'unzip -d /usr/local -q `basename $DIST_WIN_64` go/pkg/windows_amd64/*' >> $BOOTSTRAP && \
|
||||||
|
echo 'GOOS=windows GOARCH=amd64 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap' >> $BOOTSTRAP && \
|
||||||
|
echo 'unzip -d /usr/local -q `basename $DIST_WIN_32` go/pkg/windows_386/*' >> $BOOTSTRAP && \
|
||||||
|
echo 'GOOS=windows GOARCH=386 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap' >> $BOOTSTRAP && \
|
||||||
|
echo >> $BOOTSTRAP && \
|
||||||
|
echo 'rm -f `basename $DIST_LINUX_64` `basename $DIST_LINUX_32` `basename $DIST_LINUX_ARM` \\' >> $BOOTSTRAP && \
|
||||||
|
echo ' `basename $DIST_OSX_64` `basename $DIST_OSX_32` `basename $DIST_WIN_64` `basename $DIST_WIN_32`' >> $BOOTSTRAP && \
|
||||||
|
chmod +x $BOOTSTRAP
|
||||||
|
|
||||||
|
ENV PATH /usr/local/go/bin:$PATH
|
||||||
|
ENV GOPATH /go
|
||||||
|
|
||||||
|
|
||||||
|
# Create a small script to go get a package and cross compile it
|
||||||
|
ENV BUILD ./build.sh
|
||||||
|
RUN \
|
||||||
|
echo '#!/bin/bash' > $BUILD && \
|
||||||
|
echo 'set -e' >> $BUILD && \
|
||||||
|
echo >> $BUILD && \
|
||||||
|
echo 'echo Fetching $1...' >> $BUILD && \
|
||||||
|
echo 'go get $1' >> $BUILD && \
|
||||||
|
echo 'cd $GOPATH/src/$1' >> $BUILD && \
|
||||||
|
echo 'pack=`basename $1`' >> $BUILD && \
|
||||||
|
echo >> $BUILD && \
|
||||||
|
echo 'echo Compiling for linux/amd64...' >> $BUILD && \
|
||||||
|
echo 'GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o $pack-linux-amd64' >> $BUILD && \
|
||||||
|
echo >> $BUILD && \
|
||||||
|
echo 'echo Compiling for linux/386...' >> $BUILD && \
|
||||||
|
echo 'GOOS=linux GOARCH=386 CGO_ENABLED=1 go build -o $pack-linux-386' >> $BUILD && \
|
||||||
|
echo >> $BUILD && \
|
||||||
|
echo 'echo Compiling for linux/arm...' >> $BUILD && \
|
||||||
|
echo 'CC=arm-linux-gnueabi-gcc \\' >> $BUILD && \
|
||||||
|
echo ' GOOS=linux GOARCH=arm CGO_ENABLED=1 go build -o $pack-linux-arm' >> $BUILD && \
|
||||||
|
echo >> $BUILD && \
|
||||||
|
echo 'echo Compiling for windows/amd64...' >> $BUILD && \
|
||||||
|
echo 'CC=x86_64-w64-mingw32-gcc \\' >> $BUILD && \
|
||||||
|
echo ' GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build -o $pack-windows-amd64.exe' >> $BUILD && \
|
||||||
|
echo >> $BUILD && \
|
||||||
|
echo 'echo Compiling for windows/386...' >> $BUILD && \
|
||||||
|
echo 'CC=i686-w64-mingw32-gcc \\' >> $BUILD && \
|
||||||
|
echo ' GOOS=windows GOARCH=386 CGO_ENABLED=1 go build -o $pack-windows-386.exe' >> $BUILD && \
|
||||||
|
echo >> $BUILD && \
|
||||||
|
echo 'echo Compiling for darwin/amd64...' >> $BUILD && \
|
||||||
|
echo '`/osxcross/target/bin/osxcross-env`' >> $BUILD && \
|
||||||
|
echo 'CC=o64-clang \\' >> $BUILD && \
|
||||||
|
echo ' GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -o $pack-darwin-amd64' >> $BUILD && \
|
||||||
|
echo >> $BUILD && \
|
||||||
|
echo 'echo Compiling for darwin/386...' >> $BUILD && \
|
||||||
|
echo 'CC=o32-clang \\' >> $BUILD && \
|
||||||
|
echo ' GOOS=darwin GOARCH=386 CGO_ENABLED=1 go build -o $pack-darwin-386' >> $BUILD && \
|
||||||
|
echo >> $BUILD && \
|
||||||
|
echo 'echo Moving binaries to host...' >> $BUILD && \
|
||||||
|
echo 'cp `ls -t | head -n 7` /build' >> $BUILD && \
|
||||||
|
chmod +x $BUILD
|
||||||
|
|
||||||
|
ENTRYPOINT ["./build.sh"]
|
33
docker/go-1.3.0/Dockerfile
Normal file
33
docker/go-1.3.0/Dockerfile
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Go cross compiler (xgo): Go 1.3.0 layer
|
||||||
|
# Copyright (c) 2014 Péter Szilágyi. All rights reserved.
|
||||||
|
#
|
||||||
|
# Released under the MIT license.
|
||||||
|
|
||||||
|
FROM karalabe/xgo:base
|
||||||
|
|
||||||
|
MAINTAINER Péter Szilágyi <peterke@gmail.com>
|
||||||
|
|
||||||
|
# Configure the Go packages and bootstrap them
|
||||||
|
RUN \
|
||||||
|
export DIST_LINUX_64=https://storage.googleapis.com/golang/go1.3.linux-amd64.tar.gz && \
|
||||||
|
export DIST_LINUX_64_SHA1=b6b154933039987056ac307e20c25fa508a06ba6 && \
|
||||||
|
\
|
||||||
|
export DIST_LINUX_32=https://storage.googleapis.com/golang/go1.3.linux-386.tar.gz && \
|
||||||
|
export DIST_LINUX_32_SHA1=22db33b0c4e242ed18a77b03a60582f8014fd8a6 && \
|
||||||
|
\
|
||||||
|
export DIST_LINUX_ARM=http://dave.cheney.net/paste/go.1.3.linux-arm~armv5-1.tar.gz && \
|
||||||
|
export DIST_LINUX_ARM_SHA1=fc059c970a059757778b157b1140a3c56eb1a069 && \
|
||||||
|
\
|
||||||
|
export DIST_OSX_64=https://storage.googleapis.com/golang/go1.3.darwin-amd64-osx10.6.tar.gz && \
|
||||||
|
export DIST_OSX_64_SHA1=82ffcfb7962ca7114a1ee0a96cac51c53061ea05 && \
|
||||||
|
\
|
||||||
|
export DIST_OSX_32=https://storage.googleapis.com/golang/go1.3.darwin-386-osx10.6.tar.gz && \
|
||||||
|
export DIST_OSX_32_SHA1=159d2797bee603a80b829c4404c1fb2ee089cc00 && \
|
||||||
|
\
|
||||||
|
export DIST_WIN_64=https://storage.googleapis.com/golang/go1.3.windows-amd64.zip && \
|
||||||
|
export DIST_WIN_64_SHA1=1e4888e1494aed7f6934acb5c4a1ffb0e9a022b1 && \
|
||||||
|
\
|
||||||
|
export DIST_WIN_32=https://storage.googleapis.com/golang/go1.3.windows-386.zip && \
|
||||||
|
export DIST_WIN_32_SHA1=e4e5279ce7d8cafdf210a522a70677d5b9c7589d && \
|
||||||
|
\
|
||||||
|
$BOOTSTRAP
|
Loading…
x
Reference in New Issue
Block a user