Last active
September 27, 2021 11:30
-
-
Save victor141516/4ef7a6ebd0c64d50b95dd6137f2bc98a to your computer and use it in GitHub Desktop.
Pipenv lock using Docker - Pipenv breaks easilt so let's use it through Docker
This file contains hidden or 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 | |
# Usage: ./pipenvlocker [dev | all] | |
pipenv_lock_cmd='pipenv lock' | |
no_dev='--requirements > requirements.txt' | |
dev='--requirements --dev-only > requirements-dev.txt' | |
chosen="$pipenv_lock_cmd $no_dev" | |
if [ "$1" = 'dev' ]; then chosen="$pipenv_lock_cmd $dev"; fi | |
if [ "$1" = 'all' ]; then chosen="$pipenv_lock_cmd $no_dev && $pipenv_lock_cmd $dev"; fi | |
docker run --rm -it \ | |
-v "$(pwd):/app" \ | |
--workdir="/app" \ | |
--user="$UID" \ | |
python:3.8-slim bash -c "mkdir /tmp/home && \ | |
export HOME=/tmp/home && \ | |
export PATH=/tmp/home/.local/bin:\$PATH && \ | |
pip install pipenv && \ | |
$chosen" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment