hahunavth commited on
Commit
bcd771c
β€’
1 Parent(s): 6ed9dba

add dockerfile

Browse files
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .env
Dockerfile ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM lucone83/streamlit-nginx:python3.9
2
+
3
+ COPY ./ ./
4
+ COPY ./pages ./pages
5
+
6
+ # # using venv
7
+ RUN python3 -m venv /home/streamlitapp/venv
8
+ # RUN . /home/streamlitapp/venv/bin/activate
9
+ ENV VIRTUAL_ENV /home/streamlitapp/venv # activating environment
10
+ ENV PATH /home/streamlitapp/venv/bin:$PATH # activating environment
11
+
12
+ RUN /usr/local/bin/python -m pip install --upgrade pip
13
+ RUN pip install -r requirements.txt
14
+ RUN pip install --upgrade streamlit
15
+
16
+ # ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
17
+
18
+ COPY --chown=streamlitapp ./nginx.conf /home/streamlitapp/.nginx/nginx.conf
19
+
20
+ CMD [ "streamlit", "run", "home.py"]
21
+ # CMD /bin/bash -c "source /home/streamlitapp/venv/bin/activate && streamlit run home.py"
22
+ # CMD ["/bin/bash", "-c", "source /home/streamlitapp/venv/bin/activate && streamlit run home.py"]
README.md ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ docker build -t my_streamlit_app .
2
+ docker run -p 8080:8080 my_streamlit_app
home.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from os.path import join, dirname
3
+ from dotenv import load_dotenv
4
+ import streamlit as st
5
+
6
+ dotenv_path = join(dirname(__file__), '.env')
7
+ load_dotenv(dotenv_path)
8
+
9
+ st.markdown("## Home")
10
+
11
+ st.write(f"ST version: {st.__version__}")
12
+
13
+ st.write(f"KAGGLE_USERNAME: {os.environ.get('KAGGLE_USERNAME')}")
14
+
15
+ st.markdown("Go to: /tensorboard")
16
+ st.markdown("Go to: /healthz")
17
+ st.markdown("Go to: /stream")
18
+ st.markdown("Go to: /static")
nginx.conf ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pid /tmp/nginx.pid;
2
+
3
+ worker_processes auto;
4
+
5
+ events {
6
+ worker_connections 1024;
7
+ multi_accept on;
8
+ }
9
+
10
+ http {
11
+ map $http_upgrade $connection_upgrade {
12
+ default upgrade;
13
+ '' close;
14
+ }
15
+
16
+ upstream streamlit {
17
+ server 127.0.0.1:8501;
18
+ }
19
+
20
+ upstream tensorboard {
21
+ server 127.0.0.1:6006;
22
+ }
23
+
24
+ keepalive_timeout 75s;
25
+
26
+ server {
27
+ listen 8080;
28
+ charset utf-8;
29
+
30
+ location / {
31
+ proxy_http_version 1.1;
32
+ proxy_set_header Upgrade $http_upgrade;
33
+ proxy_set_header Connection $connection_upgrade;
34
+ proxy_pass http://streamlit;
35
+ auth_basic off;
36
+ }
37
+
38
+ # Streamlit endpoints
39
+ location /static {
40
+ proxy_pass http://streamlit;
41
+ }
42
+
43
+ location /stream {
44
+ proxy_http_version 1.1;
45
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
46
+ proxy_set_header Upgrade $http_upgrade;
47
+ proxy_set_header Connection $connection_upgrade;
48
+ proxy_set_header Host $http_host;
49
+ proxy_pass http://streamlit;
50
+ }
51
+
52
+ location /healthz {
53
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
54
+ proxy_set_header Host $http_host;
55
+ add_header Content-Type text/plain;
56
+ return 200 'OK';
57
+ }
58
+
59
+ # TensorBoard
60
+ location /tensorboard/ {
61
+ proxy_pass http://tensorboard/;
62
+ proxy_http_version 1.1;
63
+ proxy_set_header Upgrade $http_upgrade;
64
+ proxy_set_header Connection "upgrade";
65
+ proxy_set_header Host $host;
66
+ proxy_set_header X-Real-IP $remote_addr;
67
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
68
+ proxy_set_header X-Forwarded-Proto $scheme;
69
+ proxy_set_header X-Forwarded-Host $host;
70
+ proxy_set_header X-Forwarded-Port $server_port;
71
+ proxy_buffering off;
72
+ }
73
+ }
74
+ }
2_hf_repo_info.py β†’ pages/1_hf_repo_info.py RENAMED
File without changes
pages/{1_download_tb.py β†’ 2_download_tb.py} RENAMED
File without changes
pages/{2_tensorboard.py β†’ 3_tensorboard.py} RENAMED
File without changes
requirements.txt CHANGED
@@ -1,4 +1,10 @@
1
  huggingface_hub
2
  kaggle
3
  streamlit_tensorboard
4
- pandas
 
 
 
 
 
 
 
1
  huggingface_hub
2
  kaggle
3
  streamlit_tensorboard
4
+ pandas
5
+ tensorboard
6
+ streamlit #==1.31.1
7
+ python-dotenv
8
+
9
+ protobuf == 3.20.1
10
+ markupsafe==2.0.1