gaussian-splatting/docker/build_and_deploy.sh

45 lines
971 B
Bash
Raw Normal View History

2023-10-25 13:24:31 +00:00
#!/usr/bin/env bash
# This script builds and runs a docker image for local use.
#Although I dislike the use of docker for a myriad of reasons, due needing it to deploy on a particular machine
#I am adding a docker container builder for the repository to automate the process
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"
cd ..
REPOSITORY=`pwd`
cd "$DIR"
2023-10-25 13:26:45 +00:00
NAME="gaussian-splatting"
2023-10-25 13:24:31 +00:00
dockerfile_pth="$DIR"
mount_pth="$REPOSITORY"
# update tensorflow image
docker pull tensorflow/tensorflow:latest-gpu
# build and run tensorflow
docker build \
-t $NAME \
$dockerfile_pth \
--build-arg user_id=$UID
docker run -d \
--gpus all \
--shm-size 8G \
-it \
--name $NAME-container \
-v $mount_pth:/home/user/workspace \
$NAME
docker ps -a
2023-10-25 13:26:45 +00:00
OUR_DOCKER_ID=`docker ps -a | grep gaussian-splatting | cut -f1 -d' '`
2023-10-25 13:24:31 +00:00
echo "Our docker ID is : $OUR_DOCKER_ID"
echo "Attaching it using : docker attach $OUD_DOCKER_ID"
docker attach $OUR_DOCKER_ID
exit 0