mirror of
https://github.com/rancher/os.git
synced 2025-09-17 07:30:42 +00:00
dind-less, make-based build system
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
set -x
|
||||
|
||||
cd $(dirname $0)/..
|
||||
|
||||
source scripts/version
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case $1 in
|
||||
--custom)
|
||||
IN_DOCKER=true
|
||||
ROS_CUSTOM_GOPATH=true
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift 1
|
||||
done
|
||||
|
||||
if [ "$IN_DOCKER" != "true" ]; then
|
||||
cat > .dockerfile << "EOF"
|
||||
FROM rancher/dind:v0.5.0
|
||||
COPY ./scripts/bootstrap /scripts/bootstrap
|
||||
RUN /scripts/bootstrap
|
||||
WORKDIR /source
|
||||
ENV IN_DOCKER true
|
||||
EOF
|
||||
|
||||
docker build -t rancher-os-go-build -f .dockerfile .
|
||||
docker run --rm -v $(pwd):/source -it rancher-os-go-build ./scripts/build
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ ! -x "$(which go)" && -x /usr/local/go/bin/go ]]; then
|
||||
PATH=/usr/local/go/bin:${PATH}
|
||||
fi
|
||||
|
||||
if [ -z "$ROS_CUSTOM_GOPATH" ]; then
|
||||
export GOPATH=$(pwd)/Godeps/_workspace:$(pwd)/gopath
|
||||
fi
|
||||
|
||||
PACKAGE=./gopath/src/$(<.package)
|
||||
|
||||
if [ -L ${PACKAGE} ]; then
|
||||
rm ${PACKAGE}
|
||||
fi
|
||||
|
||||
if [ ! -e ${PACKAGE} ]; then
|
||||
mkdir -p $(dirname $PACKAGE)
|
||||
ln -s $(pwd) $PACKAGE
|
||||
fi
|
||||
|
||||
echo export GOPATH=$GOPATH
|
||||
|
||||
mkdir -p bin
|
||||
go build -tags netgo -ldflags "-X github.com/rancherio/os/config.VERSION ${VERSION:-v0.0.0-dev} -linkmode external -extldflags -static" -o bin/rancheros
|
||||
strip --strip-all bin/rancheros
|
Reference in New Issue
Block a user