Created
June 25, 2024 22:07
-
-
Save Kline-/9c74c4acb12a012f16e75cc8a49a1329 to your computer and use it in GitHub Desktop.
A wrapper for running arbitrary Python scripts inside a docker container.
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 | |
#Need to attach to a docker network for pip to function | |
NET=docker_bridge | |
if [[ -f "requirements.txt" ]]; then | |
docker run --network $NET -it --rm -v "$PWD":/usr/src/app -w /usr/src/app python:3 sh -c "python -m pip --disable-pip-version-check -qqq install -r requirements.txt ; python $*" | |
else | |
docker run --network $NET -it --rm -v "$PWD":/usr/src/app -w /usr/src/app python:3 python $@ | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment