File size: 1,198 Bytes
e136ea6
 
 
 
b9a1431
b6dff27
b9a1431
6f1c718
b6dff27
b9a1431
 
6f1c718
b9a1431
b6dff27
 
bfe5d11
6f1c718
6c42c84
b9a1431
e136ea6
 
f52af93
e136ea6
 
 
 
 
b9a1431
e136ea6
6f1c718
e136ea6
b9a1431
f52af93
 
bfe5d11
 
8e1ead8
b9a1431
b6dff27
b9a1431
6f1c718
 
e136ea6
 
f52af93
e136ea6
f52af93
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
FROM python:3.9-slim

WORKDIR /app

# Create cache and config directories with permissions
RUN mkdir -p /tmp/huggingface/hub \
    && mkdir -p /tmp/pretrained_models \
    && mkdir -p /app/.streamlit \
    && chmod -R 777 /tmp/huggingface \
    && chmod -R 777 /tmp/pretrained_models \
    && chmod -R 777 /app/.

# Set environment variables
ENV TRANSFORMERS_CACHE=/tmp/huggingface
ENV HF_HOME=/tmp/huggingface
ENV XDG_CACHE_HOME=/app/.streamlit
ENV HOME=/app

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

# Install Python packages
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

# Copy app files
COPY app.py ./
COPY utils/ ./utils/
COPY models/ ./models/
COPY .streamlit/ .streamlit/

# Fix permissions after copying files
RUN chmod -R 777 /tmp/huggingface \
    && chmod -R 777 /tmp/pretrained_models \
    && chmod -R 777 /app/.streamlit

EXPOSE 8501

HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1

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