Added ai-tools image option
This commit is contained in:
8
ai-tools/Docker/scripts/CONFIG.sh
Normal file
8
ai-tools/Docker/scripts/CONFIG.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# set -o xtrace ## To debug scripts
|
||||
# set -o errexit ## To exit on error
|
||||
# set -o errunset ## To exit if a variable is referenced but not set
|
||||
|
||||
|
||||
CONTAINER="ai-tools"
|
||||
21
ai-tools/Docker/scripts/clean.sh
Executable file
21
ai-tools/Docker/scripts/clean.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
. CONFIG.sh
|
||||
|
||||
# set -o xtrace ## To debug scripts
|
||||
# set -o errexit ## To exit on error
|
||||
# set -o errunset ## To exit if a variable is referenced but not set
|
||||
|
||||
|
||||
function main() {
|
||||
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
cd "${SCRIPTPATH}"
|
||||
echo "Working Dir: " $(pwd)
|
||||
|
||||
podman container prune
|
||||
podman image prune
|
||||
podman volume prune
|
||||
podman network prune
|
||||
}
|
||||
main $@;
|
||||
|
||||
23
ai-tools/Docker/scripts/interactive-shell.sh
Executable file
23
ai-tools/Docker/scripts/interactive-shell.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
. CONFIG.sh
|
||||
|
||||
# set -o xtrace ## To debug scripts
|
||||
# set -o errexit ## To exit on error
|
||||
# set -o errunset ## To exit if a variable is referenced but not set
|
||||
|
||||
|
||||
function main() {
|
||||
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
cd "${SCRIPTPATH}"
|
||||
echo "Working Dir: " $(pwd)
|
||||
|
||||
ID=$(podman ps --filter "ancestor=localhost/${CONTAINER}:latest" --format "{{.ID}}")
|
||||
if [ "${ID}" == "" ]; then
|
||||
echo "Is not up..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
podman exec -it "${ID}" /bin/bash
|
||||
}
|
||||
main $@;
|
||||
29
ai-tools/Docker/scripts/reset.sh
Executable file
29
ai-tools/Docker/scripts/reset.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
# . CONFIG.sh
|
||||
|
||||
# set -o xtrace ## To debug scripts
|
||||
# set -o errexit ## To exit on error
|
||||
# set -o errunset ## To exit if a variable is referenced but not set
|
||||
|
||||
|
||||
function main() {
|
||||
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
cd "${SCRIPTPATH}"
|
||||
echo "Working Dir: " $(pwd)
|
||||
|
||||
podman container prune
|
||||
podman image prune
|
||||
podman volume prune
|
||||
podman network prune
|
||||
|
||||
podman machine stop
|
||||
podman machine reset
|
||||
# podman machine init
|
||||
podman machine init --rootful
|
||||
podman machine set --memory 4096
|
||||
# podman machine set --cpus 2 --memory 4096
|
||||
podman machine start
|
||||
}
|
||||
main $@;
|
||||
|
||||
21
ai-tools/Docker/scripts/run.sh
Executable file
21
ai-tools/Docker/scripts/run.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
# . CONFIG.sh
|
||||
|
||||
# set -o xtrace ## To debug scripts
|
||||
# set -o errexit ## To exit on error
|
||||
# set -o errunset ## To exit if a variable is referenced but not set
|
||||
set -e
|
||||
|
||||
|
||||
function main() {
|
||||
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
cd "${SCRIPTPATH}"
|
||||
echo "Working Dir: " $(pwd)
|
||||
|
||||
trap "kill 0" SIGTERM SIGINT
|
||||
|
||||
# ollama launch opencode --model llama3.1
|
||||
ollama serve
|
||||
}
|
||||
main $@;
|
||||
17
ai-tools/Docker/scripts/save.sh
Executable file
17
ai-tools/Docker/scripts/save.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
. CONFIG.sh
|
||||
|
||||
# set -o xtrace ## To debug scripts
|
||||
# set -o errexit ## To exit on error
|
||||
# set -o errunset ## To exit if a variable is referenced but not set
|
||||
|
||||
|
||||
function main() {
|
||||
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
cd "${SCRIPTPATH}"
|
||||
echo "Working Dir: " $(pwd)
|
||||
|
||||
podman save -o "${CONTAINER}" $1
|
||||
}
|
||||
main $@;
|
||||
17
ai-tools/Docker/scripts/shrink.sh
Executable file
17
ai-tools/Docker/scripts/shrink.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
. CONFIG.sh
|
||||
|
||||
# set -o xtrace ## To debug scripts
|
||||
# set -o errexit ## To exit on error
|
||||
# set -o errunset ## To exit if a variable is referenced but not set
|
||||
|
||||
|
||||
function main() {
|
||||
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
cd "${SCRIPTPATH}"
|
||||
echo "Working Dir: " $(pwd)
|
||||
|
||||
qemu-img resize --shrink ~/.local/share/containers/podman/machine/qemu/podman-machine-*.qcow2 30G
|
||||
}
|
||||
main $@;
|
||||
48
ai-tools/Docker/scripts/start.sh
Executable file
48
ai-tools/Docker/scripts/start.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
. CONFIG.sh
|
||||
|
||||
# set -o xtrace ## To debug scripts
|
||||
# set -o errexit ## To exit on error
|
||||
# set -o errunset ## To exit if a variable is referenced but not set
|
||||
|
||||
|
||||
function set_routs() {
|
||||
sudo iptables -t nat -I OUTPUT -p tcp -o lo --dport 80 -j REDIRECT --to-ports 8080
|
||||
sudo iptables -t nat -I OUTPUT -p tcp -o lo --dport 443 -j REDIRECT --to-ports 4433
|
||||
}
|
||||
|
||||
function main() {
|
||||
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
cd "${SCRIPTPATH}"
|
||||
echo "Working Dir: " $(pwd)
|
||||
|
||||
ID=$(podman ps --filter "ancestor=localhost/${CONTAINER}:latest" --format "{{.ID}}")
|
||||
if [ "${ID}" != "" ]; then
|
||||
echo "Is up..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DOWNLOAD_HOST="${HOME}/Downloads"
|
||||
DOWNLOAD_CONTAINER="${HOME}/Downloads"
|
||||
CODING_HOST="${HOME}/Coding"
|
||||
CODING_CONTAINER="${HOME}/Coding"
|
||||
|
||||
# set_routs
|
||||
# sudo sysctl net.ipv4.ip_unprivileged_port_start=80
|
||||
# -p 80:80 \
|
||||
# -p 443:443 \
|
||||
|
||||
# podman run -m 4G \
|
||||
podman run -d -m 4G \
|
||||
--annotation run.oci.cdi.devices=all \
|
||||
-e NVIDIA_DRIVER_CAPABILITIES=video,compute,utility \
|
||||
-e HOME="${HOME}" \
|
||||
-v "${DOWNLOAD_HOST}":"${DOWNLOAD_CONTAINER}" \
|
||||
-v "${CODING_HOST}":"${CODING_CONTAINER}" \
|
||||
"${CONTAINER}:latest"
|
||||
|
||||
# sudo sysctl net.ipv4.ip_unprivileged_port_start=1024
|
||||
|
||||
}
|
||||
main $@;
|
||||
24
ai-tools/Docker/scripts/stop.sh
Executable file
24
ai-tools/Docker/scripts/stop.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
. CONFIG.sh
|
||||
|
||||
# set -o xtrace ## To debug scripts
|
||||
# set -o errexit ## To exit on error
|
||||
# set -o errunset ## To exit if a variable is referenced but not set
|
||||
|
||||
|
||||
|
||||
function main() {
|
||||
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
cd "${SCRIPTPATH}"
|
||||
echo "Working Dir: " $(pwd)
|
||||
|
||||
ID=$(podman ps --filter "ancestor=localhost/${CONTAINER}:latest" --format "{{.ID}}")
|
||||
if [ "${ID}" == "" ]; then
|
||||
echo "Is not up..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
podman container stop "${ID}"
|
||||
}
|
||||
main $@;
|
||||
Reference in New Issue
Block a user