research-to-production/salary/st
2022-05-26 16:02:48 +00:00

15 lines
740 B
Bash
Executable File

#!/bin/bash
echo -e "INFO:\tThis executable is a replacement for invoking \`streamlit\`; it will attempt to first launch a docker image \`streamlit:latest\` and if it cannot find \`docker\` then it will attempt to invoke \`streamlit\` directly (you will need to run \`pip install -r requirements.txt\` for it to work)\n\n"
IMAGE_NAME=streamlit:latest
COMMAND="streamlit"
OPTS="--browser.serverAddress 0.0.0.0 --server.enableCORS False --server.enableXsrfProtection False"
if ! command -v docker &> /dev/null
then
echo -e "WARNING:\tdocker could not be found, attempting running locally...\n"
$COMMAND $@ $OPTS
else
docker run --name streamlit --rm -d -p 8501:8501 -v "$(pwd)":/tmp -w /tmp "$IMAGE_NAME" "$COMMAND" $@ $OPTS
fi