Pull os/arch specific deps too.

This commit is contained in:
Péter Szilágyi 2014-12-17 16:46:05 +02:00
parent 0442d94d4f
commit 73d67ca0e7
1 changed files with 46 additions and 44 deletions

View File

@ -88,50 +88,52 @@ ENV GOPATH /go
# Create a small script to go get a package and cross compile it # Create a small script to go get a package and cross compile it
ENV BUILD ./build.sh ENV BUILD ./build.sh
RUN \ RUN \
echo '#!/bin/bash' > $BUILD && \ echo '#!/bin/bash' > $BUILD && \
echo 'set -e' >> $BUILD && \ echo 'set -e' >> $BUILD && \
echo >> $BUILD && \ echo >> $BUILD && \
echo 'echo Fetching $1...' >> $BUILD && \ echo 'echo Fetching $1...' >> $BUILD && \
echo 'go get $1' >> $BUILD && \ echo 'go get $1' >> $BUILD && \
echo 'cd $GOPATH/src/$1' >> $BUILD && \ echo 'cd $GOPATH/src/$1' >> $BUILD && \
echo >> $BUILD && \ echo >> $BUILD && \
echo 'NAME=`basename $1`' >> $BUILD && \ echo 'NAME=`basename $1`' >> $BUILD && \
echo 'if [ "$OUT" != "" ]; then' >> $BUILD && \ echo 'if [ "$OUT" != "" ]; then' >> $BUILD && \
echo ' NAME=$OUT' >> $BUILD && \ echo ' NAME=$OUT' >> $BUILD && \
echo 'fi' >> $BUILD && \ echo 'fi' >> $BUILD && \
echo >> $BUILD && \ echo >> $BUILD && \
echo 'if [ "$FLAG_V" == "true" ]; then V=-v; fi' >> $BUILD && \ echo 'if [ "$FLAG_V" == "true" ]; then V=-v; fi' >> $BUILD && \
echo 'if [ "$FLAG_RACE" == "true" ]; then R=-race; fi' >> $BUILD && \ echo 'if [ "$FLAG_RACE" == "true" ]; then R=-race; fi' >> $BUILD && \
echo >> $BUILD && \ echo >> $BUILD && \
echo 'echo Compiling for linux/amd64...' >> $BUILD && \ echo 'echo Compiling for linux/amd64...' >> $BUILD && \
echo 'GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build $V $R -o $NAME-linux-amd64$R' >> $BUILD && \ echo 'GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go get' >> $BUILD && \
echo >> $BUILD && \ echo 'GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build $V $R -o $NAME-linux-amd64$R' >> $BUILD && \
echo 'echo Compiling for linux/386...' >> $BUILD && \ echo >> $BUILD && \
echo 'GOOS=linux GOARCH=386 CGO_ENABLED=1 go build $V -o $NAME-linux-386' >> $BUILD && \ echo 'echo Compiling for linux/386...' >> $BUILD && \
echo >> $BUILD && \ echo 'GOOS=linux GOARCH=386 CGO_ENABLED=1 go get' >> $BUILD && \
echo 'echo Compiling for linux/arm...' >> $BUILD && \ echo 'GOOS=linux GOARCH=386 CGO_ENABLED=1 go build $V -o $NAME-linux-386' >> $BUILD && \
echo 'CC=arm-linux-gnueabi-gcc \\' >> $BUILD && \ echo >> $BUILD && \
echo ' GOOS=linux GOARCH=arm CGO_ENABLED=1 GOARM=5 go build $V -o $NAME-linux-arm' >> $BUILD && \ echo 'echo Compiling for linux/arm...' >> $BUILD && \
echo >> $BUILD && \ echo 'CC=arm-linux-gnueabi-gcc GOOS=linux GOARCH=arm CGO_ENABLED=1 GOARM=5 go get' >> $BUILD && \
echo 'echo Compiling for windows/amd64...' >> $BUILD && \ echo 'CC=arm-linux-gnueabi-gcc GOOS=linux GOARCH=arm CGO_ENABLED=1 GOARM=5 go build $V -o $NAME-linux-arm' >> $BUILD && \
echo 'CC=x86_64-w64-mingw32-gcc \\' >> $BUILD && \ echo >> $BUILD && \
echo ' GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build $V $R -o $NAME-windows-amd64$R.exe' >> $BUILD && \ echo 'echo Compiling for windows/amd64...' >> $BUILD && \
echo >> $BUILD && \ echo 'CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go get' >> $BUILD && \
echo 'echo Compiling for windows/386...' >> $BUILD && \ echo 'CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build $V $R -o $NAME-windows-amd64$R.exe' >> $BUILD && \
echo 'CC=i686-w64-mingw32-gcc \\' >> $BUILD && \ echo >> $BUILD && \
echo ' GOOS=windows GOARCH=386 CGO_ENABLED=1 go build $V -o $NAME-windows-386.exe' >> $BUILD && \ echo 'echo Compiling for windows/386...' >> $BUILD && \
echo >> $BUILD && \ echo 'CC=i686-w64-mingw32-gcc GOOS=windows GOARCH=386 CGO_ENABLED=1 go get' >> $BUILD && \
echo 'echo Compiling for darwin/amd64...' >> $BUILD && \ echo 'CC=i686-w64-mingw32-gcc GOOS=windows GOARCH=386 CGO_ENABLED=1 go build $V -o $NAME-windows-386.exe' >> $BUILD && \
echo '`/osxcross/target/bin/osxcross-env`' >> $BUILD && \ echo >> $BUILD && \
echo 'CC=o64-clang \\' >> $BUILD && \ echo 'echo Compiling for darwin/amd64...' >> $BUILD && \
echo ' GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build $V $R -o $NAME-darwin-amd64$R' >> $BUILD && \ echo '`/osxcross/target/bin/osxcross-env`' >> $BUILD && \
echo >> $BUILD && \ echo 'CC=o64-clang GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go get' >> $BUILD && \
echo 'echo Compiling for darwin/386...' >> $BUILD && \ echo 'CC=o64-clang GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build $V $R -o $NAME-darwin-amd64$R' >> $BUILD && \
echo 'CC=o32-clang \\' >> $BUILD && \ echo >> $BUILD && \
echo ' GOOS=darwin GOARCH=386 CGO_ENABLED=1 go build $V -o $NAME-darwin-386' >> $BUILD && \ echo 'echo Compiling for darwin/386...' >> $BUILD && \
echo >> $BUILD && \ echo 'CC=o32-clang GOOS=darwin GOARCH=386 CGO_ENABLED=1 go get' >> $BUILD && \
echo 'echo Moving binaries to host...' >> $BUILD && \ echo 'CC=o32-clang GOOS=darwin GOARCH=386 CGO_ENABLED=1 go build $V -o $NAME-darwin-386' >> $BUILD && \
echo 'cp `ls -t | head -n 7` /build' >> $BUILD && \ echo >> $BUILD && \
echo 'echo Moving binaries to host...' >> $BUILD && \
echo 'cp `ls -t | head -n 7` /build' >> $BUILD && \
chmod +x $BUILD chmod +x $BUILD
ENTRYPOINT ["./build.sh"] ENTRYPOINT ["./build.sh"]