sakshamlakhera commited on
Commit
e775ab8
·
1 Parent(s): 4f47ea9

docker change

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -13
Dockerfile CHANGED
@@ -1,7 +1,8 @@
1
  FROM python:3.12-slim
2
 
3
  WORKDIR /app
4
- RUN chmod -R 777 /app
 
5
  RUN apt-get update && apt-get install -y \
6
  build-essential \
7
  curl \
@@ -9,28 +10,31 @@ RUN apt-get update && apt-get install -y \
9
  git \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # Set safe environment paths for Streamlit and Torch
13
- ENV STREAMLIT_HOME="/.streamlit"
14
- ENV TORCH_HOME="/.cache/torch"
15
- ENV GDOWN_HOME="/.cache/gdown/"
 
16
 
17
- # Create writable directories
18
- RUN mkdir -p $XDG_CACHE_HOME $TORCH_HOME $GDOWN_CACHE_DIR /assets \
19
- && chmod -R 777 $XDG_CACHE_HOME $TORCH_HOME $GDOWN_CACHE_DIR /assets
20
 
21
- # Copy app code
22
  COPY . .
23
 
24
  # Install Python dependencies
25
  RUN pip3 install --no-cache-dir -r requirements.txt
26
 
27
- # Expose Streamlit port
28
  EXPOSE 8501
29
 
30
- # Add health check for Docker
31
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
32
-
33
  ENV STREAMLIT_SERVER_ENABLECORS=false
 
 
 
34
 
35
  # Run Streamlit
36
  ENTRYPOINT ["streamlit", "run", "Home.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
1
  FROM python:3.12-slim
2
 
3
  WORKDIR /app
4
+
5
+ # Update and install dependencies
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  curl \
 
10
  git \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Set writable cache paths
14
+ ENV STREAMLIT_HOME="/app/.streamlit"
15
+ ENV TORCH_HOME="/app/.cache/torch"
16
+ ENV GDOWN_HOME="/app/.cache/gdown"
17
+ ENV XDG_CACHE_HOME="/app/.cache"
18
 
19
+ # Create cache/config directories
20
+ RUN mkdir -p $STREAMLIT_HOME $TORCH_HOME $GDOWN_HOME $XDG_CACHE_HOME /app/assets \
21
+ && chmod -R 777 $STREAMLIT_HOME $TORCH_HOME $GDOWN_HOME $XDG_CACHE_HOME /app/assets
22
 
23
+ # Copy source code
24
  COPY . .
25
 
26
  # Install Python dependencies
27
  RUN pip3 install --no-cache-dir -r requirements.txt
28
 
29
+ # Expose Streamlit default port
30
  EXPOSE 8501
31
 
32
+ # Disable CORS (use only if safe)
 
 
33
  ENV STREAMLIT_SERVER_ENABLECORS=false
34
+ RUN chmod -R 777 /app
35
+ # Health check for Docker
36
+ HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
37
 
38
  # Run Streamlit
39
  ENTRYPOINT ["streamlit", "run", "Home.py", "--server.port=8501", "--server.address=0.0.0.0"]
40
+