Last active
December 21, 2023 20:26
-
-
Save mrjk/072e6eae1aae0af456d8d3d9563702b9 to your computer and use it in GitHub Desktop.
Minimal bash cli script
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 | |
set -eu | |
# set -x | |
install_system() | |
{ | |
apt install python3 py3-pip git | |
pip install --root-user-action=ignore poetry | |
} | |
install_project() | |
{ | |
local project=$1 | |
local dest=$2 | |
local version=${3:-main} | |
git clone "$project" --branch "$version" "/opt/$dest" | |
( | |
cd "/opt/$dest"; | |
poetry config --local virtualenvs.in-project true; | |
poetry install; | |
) | |
} | |
run_app () | |
{ | |
local app_name=$1 | |
shift 1 | |
/opt/$app_name/.venv/bin/$app_name $@ | |
} | |
main () | |
{ | |
#install_system | |
install_project 'https://github.com/mrjk/dockerns.git' 'skatepong' | |
run_app skatepong $@ | |
} | |
main $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment