#!/bin/bash

set -e
set -x

pushd build_calicoctl
docker build -t calico-build .
popd

mkdir -p `pwd`/dist
chmod 777 `pwd`/dist

docker rm -f pyinstaller || true
# mount calico_containers and dist under /code work directory.  Don't use /code
# as the mountpoint directly since the host permissions may not allow the
# `user` account in the container to write to it.
docker run -v `pwd`/calico_containers:/code/calico_containers \
 -v `pwd`/dist:/code/dist --name pyinstaller \
 -e PYTHONPATH=/code/calico_containers \
 calico-build \
 pyinstaller calico_containers/calicoctl.py -a -F -s --clean
docker rm -f pyinstaller || true

docker rm -f docopt || true
# mount calico_containers and dist under /code work directory.  Don't use /code
# as the mountpoint directly since the host permissions may not allow the
# `user` account in the container to write to it.
docker run -v `pwd`/calico_containers:/code/calico_containers \
 -v `pwd`/dist:/code/dist --name docopt calico-build \
 /bin/sh -c 'cd dist; docopt-completion --manual-bash ./calicoctl'
docker rm -f docopt || true

echo "Build output is in dist/"
echo "Copy dist/calicoctl.sh to /etc/bash_completion.d/ to get bash completion"

#!/bin/bash

set -e
set -x

pushd build_calicoctl
docker build -t calico-build .
popd

mkdir -p `pwd`/dist
chmod 777 `pwd`/dist

docker rm -f pyinstaller || true
# mount calico_containers and dist under /code work directory.  Don't use /code
# as the mountpoint directly since the host permissions may not allow the
# `user` account in the container to write to it.
docker run -v `pwd`/calico_containers:/code/calico_containers \
 -v `pwd`/dist:/code/dist --name pyinstaller \
 -e PYTHONPATH=/code/calico_containers \
 calico-build \
 pyinstaller calico_containers/calicoctl.py -a -F -s --clean
docker rm -f pyinstaller || true

docker rm -f docopt || true
# mount calico_containers and dist under /code work directory.  Don't use /code
# as the mountpoint directly since the host permissions may not allow the
# `user` account in the container to write to it.
docker run -w /code/dist -v `pwd`/calico_containers:/code/calico_containers \
 -v `pwd`/dist:/code/dist --name docopt calico-build \
 docopt-completion --manual-bash ./calicoctl
docker rm -f docopt || true

echo "Build output is in dist/"
echo "Copy dist/calicoctl.sh to /etc/bash_completion.d/ to get bash completion"

Use -w flag to change working directory
Use -w flag to change working directory


Former-commit-id: 2928d46c6f8dca60fcf1d84610f397fdeb7a08d4