From 3e05e72a97d6d5b01dba70b4a652dbed3bf0b1eb Mon Sep 17 00:00:00 2001 From: Francois Pelletier Date: Wed, 4 Jan 2023 21:46:26 -0500 Subject: [PATCH] Port 8051 et ajout Dockerfile --- Dockerfile | 16 ++++++++++++++++ build-local.sh | 1 + docker-run.sh | 8 ++++++++ main.py | 2 +- run.sh | 4 ++-- 5 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 Dockerfile create mode 100644 build-local.sh create mode 100644 docker-run.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..763e0ed --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM python:3.10-slim + +EXPOSE 8051 + +WORKDIR /app + +# Install the app's dependencies +COPY requirements.txt . +RUN pip install -r requirements.txt + +# Copy the app's code +COPY main.py . + +# Set the entrypoint to run the app +ENTRYPOINT [ "streamlit", "run" ] +CMD [ "main.py", "--server.port=8080", "--server.headless", "true", "--server.fileWatcherType", "none", "--browser.gatherUsageStats", "false"] \ No newline at end of file diff --git a/build-local.sh b/build-local.sh new file mode 100644 index 0000000..f0a332c --- /dev/null +++ b/build-local.sh @@ -0,0 +1 @@ +docker build -t local/fabriquedoc-frontend . \ No newline at end of file diff --git a/docker-run.sh b/docker-run.sh new file mode 100644 index 0000000..16f1b22 --- /dev/null +++ b/docker-run.sh @@ -0,0 +1,8 @@ +#!/usr/bin/zsh + +#!/usr/bin/zsh + +docker stop fabriquedoc-frontend +docker rm fabriquedoc-frontend +# Ce programme sert à lancer le job_dispatcher dans un docker localement pour tester +docker run -p 8051:8051 -e FABRIQUEDOC_ENDPOINT=0.0.0.0:8080 --name fabriquedoc-frontend --network host local/fabriquedoc-frontend \ No newline at end of file diff --git a/main.py b/main.py index 36451cc..3eecb21 100644 --- a/main.py +++ b/main.py @@ -24,7 +24,7 @@ import os st.title("Fabrique à documents") -fabriquedoc_endpoint = os.environ.get("FABRIQUEDOC_ENDPOINT", "http://0.0.0.0:8000") +fabriquedoc_endpoint = os.environ.get("FABRIQUEDOC_ENDPOINT", "http://0.0.0.0:8051") tab1, tab2, tab3 = st.tabs(["Markdown", "Aperçu", "Paramètres"]) diff --git a/run.sh b/run.sh index e97f5cb..1ae3d2b 100644 --- a/run.sh +++ b/run.sh @@ -1,2 +1,2 @@ -export FABRIQUEDOC_ENDPOINT="http://0.0.0.0:8000" -streamlit run main.py +export FABRIQUEDOC_ENDPOINT="http://0.0.0.0:8051" +streamlit run main.py --server.port=8051