Anthony Truchet commited on
Commit
ec78e7f
·
1 Parent(s): ba63584

fix: streamlit config work local and on HF

Browse files
Files changed (2) hide show
  1. .streamlit/config.toml +4 -0
  2. Dockerfile +12 -14
.streamlit/config.toml CHANGED
@@ -7,5 +7,9 @@ font="sans serif"
7
 
8
  [server]
9
  maxUploadSize = 200
 
 
 
 
10
  address = "0.0.0.0"
11
  port = 8501
 
7
 
8
  [server]
9
  maxUploadSize = 200
10
+ headless = true
11
+ enableCORS = false
12
+ enableXsrfProtection = false
13
+ fileWatcherType = none
14
  address = "0.0.0.0"
15
  port = 8501
Dockerfile CHANGED
@@ -9,32 +9,30 @@ RUN apt-get update && xargs -r -a /app/packages.txt apt-get install -y && rm -rf
9
  RUN pip3 install --upgrade pip
10
  RUN pip3 install --no-cache-dir -r /app/requirements.txt
11
 
 
 
 
 
 
 
 
 
12
  # Persistent disk space
13
  # see https://huggingface.co/docs/hub/spaces-storage
14
  RUN mkdir -p /data/.huggingface
15
  ENV HF_HOME /data/.huggingface
 
16
 
17
  # User
18
- RUN useradd -m -u 1000 user
19
  USER user
20
  ENV HOME /home/user
21
  ENV PATH $HOME/.local/bin:$PATH
22
 
 
23
 
24
- WORKDIR $HOME
25
- RUN mkdir app
26
- WORKDIR $HOME/app
27
- COPY . $HOME/app
28
 
29
- # Back to root to fix ownership and permissions
30
- USER root
31
- RUN chown user /data/.huggingface
32
- USER user
33
 
34
  # Expose streamlit application
35
  EXPOSE 8501
36
- CMD streamlit run app.py \
37
- --server.headless true \
38
- --server.enableCORS false \
39
- --server.enableXsrfProtection false \
40
- --server.fileWatcherType none
 
9
  RUN pip3 install --upgrade pip
10
  RUN pip3 install --no-cache-dir -r /app/requirements.txt
11
 
12
+ # Creates an unpriviliedged user
13
+ RUN useradd -m -u 1000 user
14
+ # Copy our code to /app taking car of the permissions
15
+ COPY --chown=root:user --chmod=g+rXs src/ /app/
16
+ # Copy the config file for streamlit
17
+ RUN mkdir -p /app/.streamlit
18
+ COPY .streamlit /app/.streamlit
19
+
20
  # Persistent disk space
21
  # see https://huggingface.co/docs/hub/spaces-storage
22
  RUN mkdir -p /data/.huggingface
23
  ENV HF_HOME /data/.huggingface
24
+ RUN chown user /data/.huggingface
25
 
26
  # User
 
27
  USER user
28
  ENV HOME /home/user
29
  ENV PATH $HOME/.local/bin:$PATH
30
 
31
+ WORKDIR /app/
32
 
 
 
 
 
33
 
 
 
 
 
34
 
35
  # Expose streamlit application
36
  EXPOSE 8501
37
+ CMD streamlit run athai/app.py \
38
+