Skip to content

Instantly share code, notes, and snippets.

@kbrownlees
Created September 22, 2017 04:27
Show Gist options
  • Save kbrownlees/80c1a16aa226e5d52677e011b14767a9 to your computer and use it in GitHub Desktop.
Save kbrownlees/80c1a16aa226e5d52677e011b14767a9 to your computer and use it in GitHub Desktop.
Bash script to create a frozen set of a requirements from a requirements.txt using pip
#!/usr/bin/env bash
set -ex
if [ "$1" = "build" ]; then
cd /tmp/build
mkdir -p cache
pip install --cache-dir cache -r requirements.txt
pip freeze > requirements_frozen.txt
pip list --outdated --format columns
else
mkdir -p build
cp requirements.txt build
cp scripts/update_frozen.sh build
docker run --rm -it -v $(pwd)/build:/tmp/build python:3.5 /tmp/build/update_frozen.sh build
cp build/requirements_frozen.txt requirements_frozen.txt
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment