48 lines
1.2 KiB
Bash
48 lines
1.2 KiB
Bash
#! /bin/bash
|
|
|
|
set -e
|
|
set -o pipefail
|
|
|
|
if ! grep tabtab .gitignore; then
|
|
echo >> .gitignore
|
|
echo tabtab >> .gitignore
|
|
fi
|
|
|
|
image_ui=bel/tabtab:ui-$(date +%Y%m%d)
|
|
if ! docker images | grep ${image_ui##*:}; then
|
|
if ! [ -d ./tabtab ]; then
|
|
git clone https://github.com/ainize-team/tabtab.git
|
|
fi
|
|
pushd tabtab
|
|
cp ../tabtab.requirements.txt ./requirements.txt
|
|
docker build -t $image_ui .
|
|
popd
|
|
fi
|
|
|
|
if ! [ -d ./models ]; then
|
|
mkdir ./models
|
|
python3 -c 'from tqdm import tqdm' &> /dev/null || pip3 install tqdm
|
|
python3 ./download.py 124M
|
|
fi
|
|
|
|
image_server=${image_ui//:ui/:server}
|
|
if ! docker images | grep ${image_server##*:}; then
|
|
if ! [ -d ./gpt2-large ]; then
|
|
git clone https://github.com/Henriquepheak/gpt2-large.git
|
|
fi
|
|
pushd ./gpt2-large
|
|
docker build -t $image_server .
|
|
popd
|
|
fi
|
|
|
|
cleanup() {
|
|
docker rm -f $(docker ps -aq)
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
localhost=$(ifconfig | grep -o '192.168[^ ]*' | head -n 1)
|
|
docker run -p 12313:80 --rm -d --name tabtab-server $image_server
|
|
docker run -p 12314:80 --rm -d --name tabtab-ui -e GPT2_SERVER_URL=http://$localhost:12313 $image_ui
|
|
|
|
docker logs -f $image_ui
|