Anthony Truchet commited on
Commit ·
29bfc7e
1
Parent(s): d7d6b2f
build: add a convenience script to build and run the container locally
Browse files
scripts/build-run-local-docker.sh
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env sh
|
| 2 |
+
CONTAINER_NAME=persistent-docker-space
|
| 3 |
+
VOLUME_NAME=ai-playground-vol
|
| 4 |
+
|
| 5 |
+
set -e # Exits on first error
|
| 6 |
+
|
| 7 |
+
SCRIPT_PATH="$(realpath "${BASH_SOURCE:-$0}")"
|
| 8 |
+
ROOT_DIRECTORY="$(dirname "$(dirname "${SCRIPT_PATH}")")"
|
| 9 |
+
pushd $ROOT_DIRECTORY
|
| 10 |
+
echo "Running from ROOT_DIRECTORY: ${ROOT_DIRECTORY}"
|
| 11 |
+
|
| 12 |
+
# Export the dependencies managed by Poetry in the requirements.txt format for pip
|
| 13 |
+
poetry export -f requirements.txt -o requirements.txt --without-hashes --only=main
|
| 14 |
+
|
| 15 |
+
# Re-build the docker image.
|
| 16 |
+
docker build --label tests -t $CONTAINER_NAME .
|
| 17 |
+
|
| 18 |
+
docker run -it \
|
| 19 |
+
-p 8501:8501 \
|
| 20 |
+
--mount type=volume,src=$VOLUME_NAME,dst=/data \
|
| 21 |
+
$CONTAINER_NAME:latest
|
| 22 |
+
|
| 23 |
+
popd
|