diff --git a/Dockerfile.Artefact b/Dockerfile.Artefact new file mode 100644 index 0000000..4b2b132 --- /dev/null +++ b/Dockerfile.Artefact @@ -0,0 +1,32 @@ +FROM python:3.8-slim-buster + +ENV LANG=C.UTF-8 \ + LC_ALL=C.UTF-8 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + curl build-essential \ + && rm -rf /var/lib/apt/lists/* + +RUN useradd -d /home/docker_user -m -s /bin/bash docker_user +USER docker_user + +RUN mkdir -p /home/docker_user/workspace +WORKDIR /home/docker_user/workspace + +# Install Poetry +RUN curl -sSL https://raw.githubusercontent.com/python-poetry/install.python-poetry.org/main/install-poetry.py | POETRY_HOME=/home/docker_user/poetry python + +ENV PATH="${PATH}:/home/docker_user/.poetry/bin:/home/docker_user/poetry/bin" + +COPY pyproject.toml ./ +COPY poetry.lock ./ + +RUN poetry install --no-root --no-dev + +COPY . /home/docker_user/workspace/ + +EXPOSE 8080 + +# Set the entry point to run the Streamlit application +ENTRYPOINT ["poetry", "run", "streamlit_prophet", "deploy", "dashboard-with-base-path"] diff --git a/streamlit_prophet/app/__init__.py b/streamlit_prophet/app/__init__.py index 7d9fc20..88208b0 100644 --- a/streamlit_prophet/app/__init__.py +++ b/streamlit_prophet/app/__init__.py @@ -13,3 +13,14 @@ def deploy_streamlit(): "--server.address=0.0.0.0", ] sys.exit(cli.main()) + +def deploy_streamlit_with_base_path(): + sys.argv = [ + "streamlit", + "run", + f"{os.path.dirname(os.path.realpath(__file__))}/dashboard.py", + "--server.port=8080", + "--server.address=0.0.0.0", + "--server.baseUrlPath=/streamlit-prophet", + ] + sys.exit(cli.main()) diff --git a/streamlit_prophet/cli/deploy.py b/streamlit_prophet/cli/deploy.py index 2cc5c72..9b3c448 100755 --- a/streamlit_prophet/cli/deploy.py +++ b/streamlit_prophet/cli/deploy.py @@ -1,6 +1,6 @@ import typer from rich.console import Console -from streamlit_prophet.app import deploy_streamlit +from streamlit_prophet.app import deploy_streamlit, deploy_streamlit_with_base_path app = typer.Typer() console = Console() @@ -10,3 +10,8 @@ def dashboard() -> None: """Deploys the streamlit dashboard.""" deploy_streamlit() + +@app.command() +def dashboard_with_base_path() -> None: + """Deploys the streamlit dashboard with a base path.""" + deploy_streamlit_with_base_path() \ No newline at end of file