Anthony Truchet commited on
Commit
34227d8
ยท
1 Parent(s): d9c9597

feat: adds .env support for credentials

Browse files
.dockerignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .env
.gitignore CHANGED
@@ -1,4 +1,5 @@
1
  doc/_autosummary
 
2
 
3
  .envrc
4
  .idea
 
1
  doc/_autosummary
2
+ .env
3
 
4
  .envrc
5
  .idea
Dockerfile CHANGED
@@ -92,5 +92,5 @@ ENV PYTHONPATH=$APP_CODE:$PYTHONPATH
92
  # Expose streamlit application
93
  EXPOSE 8501
94
  EXPOSE 7860
95
- ENTRYPOINT ["bash"]
96
- CMD [start_strealit.sh]
 
92
  # Expose streamlit application
93
  EXPOSE 8501
94
  EXPOSE 7860
95
+ ENTRYPOINT [bash]
96
+ CMD [start_server.sh]
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: Streamlit Docker Template
3
  emoji: ๐Ÿ“‰
4
  colorFrom: blue
5
  colorTo: green
@@ -12,7 +12,7 @@ pinned: false
12
  duplicated_from: SpacesExamples/streamlit-docker-example
13
  ---
14
 
15
- # ๐Ÿง  Persistent Streamlit Docker Template ๐Ÿ”Ž
16
 
17
  Streamlit Docker Template is a template for creating a Streamlit app with Docker and Hugging Face Spaces.
18
 
 
1
  ---
2
+ title: Jupyter and Streamlit Docker Template
3
  emoji: ๐Ÿ“‰
4
  colorFrom: blue
5
  colorTo: green
 
12
  duplicated_from: SpacesExamples/streamlit-docker-example
13
  ---
14
 
15
+ # ๐Ÿง  Persistent Jupyter and Streamlit Docker Template ๐Ÿ”Ž
16
 
17
  Streamlit Docker Template is a template for creating a Streamlit app with Docker and Hugging Face Spaces.
18
 
env.template ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Copy this file as `.env` and insert your credential
2
+ # But do not commit it to Git or add it to the Dockerfile
3
+ JUPYTER_TOKEN=
scripts/build-run-local-docker.sh CHANGED
@@ -17,12 +17,14 @@ docker build --label tests -t $CONTAINER_NAME .
17
 
18
  # During development ONLY use a `bind mount` to enable
19
  # editing the code without having to rebuild the container.
20
- docker run --rm -it \
21
- -p 8501:8501 -p 7860:7860 \
 
22
  --mount type=volume,src=$VOLUME_NAME,dst=/data \
23
- --mount type=bind,source=${ROOT_DIRECTORY}/src/,target=/app/,readonly \
24
  --mount type=bind,source=${ROOT_DIRECTORY}/.streamlit,target=/user/.streamlit,readonly \
25
- $CONTAINER_NAME:latest \
26
- $@
 
 
27
 
28
- popd
 
17
 
18
  # During development ONLY use a `bind mount` to enable
19
  # editing the code without having to rebuild the container.
20
+ docker run --rm -it \
21
+ -p 8501:8501 -p 7860:7860 \
22
+ --env .env \
23
  --mount type=volume,src=$VOLUME_NAME,dst=/data \
24
+ --mount type=bind,source=${ROOT_DIRECTORY}/src/,target=/app/,readonly \
25
  --mount type=bind,source=${ROOT_DIRECTORY}/.streamlit,target=/user/.streamlit,readonly \
26
+ $CONTAINER_NAME:latest \
27
+ $@ # Pass all command line argument quoted in a good way
28
+
29
+ popd > /dev/null
30
 
 
start_jupyter.sh CHANGED
@@ -1,8 +1,6 @@
1
  #!/bin/bash
2
  set -e
3
 
4
- JUPYTER_TOKEN="${JUPYTER_TOKEN:=huggingface}"
5
-
6
  jupyter lab \
7
  --ip "0.0.0.0" \
8
  --port 7860 \
 
1
  #!/bin/bash
2
  set -e
3
 
 
 
4
  jupyter lab \
5
  --ip "0.0.0.0" \
6
  --port 7860 \
start_server.sh CHANGED
@@ -1,4 +1,3 @@
1
  #!/bin/bash
2
 
3
- echo "TODO launch init / service"
4
-
 
1
  #!/bin/bash
2
 
3
+ source start_jupyter.sh