1
0
mirror of https://github.com/rancher/os.git synced 2025-06-22 13:07:04 +00:00
os/scripts/build

44 lines
916 B
Plaintext
Raw Normal View History

2015-02-09 04:38:37 +00:00
#!/bin/bash -e
2015-03-18 13:28:05 +00:00
set -x
2015-02-09 04:38:37 +00:00
cd $(dirname $0)/..
2015-03-18 13:28:05 +00:00
if [ "$IN_DOCKER" != "true" ]; then
cat > .dockerfile << "EOF"
FROM rancher/dind:v0.1.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}
2015-02-09 04:38:37 +00:00
fi
2015-02-14 16:35:46 +00:00
if [ -z "$ROS_CUSTOM_GOPATH" ]; then
export GOPATH=$(pwd)/Godeps/_workspace:$(pwd)/gopath
fi
2015-02-09 04:38:37 +00:00
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 -ldflags "-linkmode external -extldflags -static" -o bin/rancheros
2015-02-23 03:57:19 +00:00
strip --strip-all bin/rancheros