Skip to content

Commit

Permalink
fix: add custom Docker for Artefact
Browse files Browse the repository at this point in the history
  • Loading branch information
TomDarmon committed May 6, 2024
1 parent 2a91b91 commit 493021a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
32 changes: 32 additions & 0 deletions Dockerfile.Artefact
Original file line number Diff line number Diff line change
@@ -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"]
13 changes: 12 additions & 1 deletion streamlit_prophet/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ def deploy_streamlit():
"run",
f"{os.path.dirname(os.path.realpath(__file__))}/dashboard.py",
"--server.port=8080",
"--server.address=0.0.0.0",
"--browser.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",
"--browser.address=0.0.0.0",
"--server.baseUrlPath=/streamlit-prophet",
]
sys.exit(cli.main())
7 changes: 6 additions & 1 deletion streamlit_prophet/cli/deploy.py
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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()

0 comments on commit 493021a

Please sign in to comment.