File size: 1,427 Bytes
869d37b
af87ccd
 
e775ab8
 
af87ccd
 
 
 
 
 
 
ec5275c
 
 
 
e775ab8
fad0a3e
 
 
 
cd681a1
e775ab8
 
 
cd681a1
af87ccd
1cce45a
 
 
 
 
 
 
 
cd681a1
fdf5718
af87ccd
e775ab8
4f47ea9
af87ccd
e775ab8
eb6667d
ec5275c
e775ab8
 
fad0a3e
cd681a1
2660b8c
 
e775ab8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
FROM python:3.12-slim

WORKDIR /app

# Update and install dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    software-properties-common \
    git \
    && rm -rf /var/lib/apt/lists/*

# Copy source code
COPY . /app
RUN chmod -R 777 /app

# Set writable cache paths
ENV STREAMLIT_HOME="/.streamlit"
ENV TORCH_HOME="/.cache/torch"
ENV GDOWN_HOME="/.cache/gdown"
ENV XDG_CACHE_HOME="/.cache"

# Create cache/config directories
RUN mkdir -p $STREAMLIT_HOME $TORCH_HOME $GDOWN_HOME $XDG_CACHE_HOME /app/assets \
    && chmod -R 777 $STREAMLIT_HOME $TORCH_HOME $GDOWN_HOME $XDG_CACHE_HOME /app/assets


ENV STREAMLIT_HOME="/app/.streamlit"
ENV TORCH_HOME="/app/.cache/torch"
ENV GDOWN_HOME="/app/.cache/gdown"
ENV XDG_CACHE_HOME="/app/.cache"

RUN mkdir -p $STREAMLIT_HOME $TORCH_HOME $GDOWN_HOME $XDG_CACHE_HOME /app/assets \
    && chmod -R 777 $STREAMLIT_HOME $TORCH_HOME $GDOWN_HOME $XDG_CACHE_HOME /app/assets

# Install Python dependencies
RUN pip3 install --no-cache-dir -r requirements.txt

# Expose Streamlit default port
EXPOSE 8501

# Disable CORS (use only if safe)
ENV STREAMLIT_SERVER_ENABLECORS=false

# Health check for Docker
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
ENV PYTHONUNBUFFERED=1
# Run Streamlit

ENTRYPOINT ["streamlit", "run", "Home.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]