From 1e7c7ac43f4f1058951e08e79438585a7f0f5d7f Mon Sep 17 00:00:00 2001 From: Luke Tyler Downey Date: Wed, 25 Oct 2017 23:17:22 +0000 Subject: [PATCH] Script that packages the app in a virtualenv --- build.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..c7cc3a8 --- /dev/null +++ b/build.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# Basic packaging script that rolls the app and its deps +# into a standalone pex + + +# Clean any stale state +rm -rf build + +# Create and push the build dir +mkdir build build/egg build/pex +pushd build + +# Create and activate a virtualenv for chroot-ish packaging +virtualenv venv +source venv/bin/activate + +# Install pex and its dependencies then package up the app +pip install pex +pex .. -v \ + --output-file=discovery.pex \ + --requirement=$(realpath ../requirements.txt) \ + --disable-cache \ + --pex-root=pex \ + -e app:app.run + +# Deactivate the virtualenv +deactivate + +# Pop back to the top-level dir +popd