Created
September 13, 2015 19:13
-
-
Save kevinastone/f2c148a52dd0b59ffc3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Virtual Env Export | |
# | |
# Copies the dist-packages directory out of a built container. | |
# | |
# This allows you access the packages installed (say for IDE support). | |
if [ $# -lt 1 ]; then | |
echo "Usage: $0 CONTAINER [DEST]" | |
exit 1 | |
fi | |
CONTAINER="$1" | |
CONTAINER_ID=$(docker create "$CONTAINER") | |
DEST_CONTAINER=$(echo "$CONTAINER" | sed 's/[a-zA-Z0-9_\-]\+\.\([a-zA-Z0-9_\-]\+\)\.[0-9]\+/\1/') | |
DEST="${2-$DEST_CONTAINER-venv}" | |
mkdir -p "${DEST}" | |
set -x | |
docker cp "$CONTAINER_ID":/usr/local/lib/python2.7/dist-packages "${DEST}" | |
set +x | |
docker rm "$CONTAINER_ID" | |
echo "VirtualEnv copied to ${DEST}/dist-packages" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment