Files
podi/recipe/init/gitops/jail
2022-02-21 16:09:16 +01:00

26 lines
865 B
Plaintext

# info: runs app/ssh-sessions in oci container using docker or podman
# installation : run 'podi recipe env-file' or put this file into .podi folder
# example usage: * put an .env file in your repo (with 'export FOO=1' e.g.)
# * [IMAGE=alpine] ./podi init git@server:/dir/to/deploy [branch] [port] [name]
# * automatic ssh-into-container (docker/podman) is now enabled
jail(){
header .pod/start/containerize
print "initing automatic ssh-into-container"
print "writing ~/.profile"
install(){
script='
u=$(whoami)
test -z $JAIL_IMAGE && JAIL_IMAGE=busybox
test $u = "root" || {
oci=$(which podman || which docker)
$oci run -it -v /home/$u:/home/$u -w /home/$u $JAIL_IMAGE /bin/sh
exit
}
'
echo "$script" | awk '{$1=$1};1'
}
install > ~/.profile
}