File size: 2,971 Bytes
5904ddc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0289713
 
d60424a
974fb82
 
5904ddc
 
 
 
 
 
 
 
d9c7b42
d60424a
6ad39a0
 
f87c5d0
7ed95c2
f87c5d0
700b214
d60424a
700b214
 
 
 
2e446b4
5904ddc
0e2acfc
 
d60424a
f87c5d0
7ed95c2
5344d27
efe6c24
5904ddc
 
 
 
7ed95c2
f87c5d0
 
974fb82
d60424a
974fb82
5904ddc
 
 
d9c7b42
5904ddc
 
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# FROM python:3.10-slim

# # Set working directory
# WORKDIR /app

# # Install system packages
# RUN apt-get update && apt-get install -y ffmpeg git wget && rm -rf /var/lib/apt/lists/*

# # Set environment for proper model caching and permissions
# ENV PYTHONUNBUFFERED=1
# ENV HOME=/app
# ENV XDG_CACHE_HOME=/app/.cache
# ENV SPEECHBRAIN_CACHE=/app/.cache/speechbrain

# # Create all needed directories with write permissions
# RUN mkdir -p /app/pretrained_models \
#     /app/wav2vec2_checkpoints \
#     /app/pretrained_asr \
#     /app/.cache/whisper \
#     /app/.cache/speechbrain \
#     /app/tmp \
#     && chmod -R 777 /app/pretrained_models \
#                     /app/wav2vec2_checkpoints \
#                     /app/pretrained_asr \
#                     /app/.cache \
#                     /app/tmp \
#                     /app

# # Upgrade pip
# RUN pip install --no-cache-dir --upgrade pip --root-user-action=ignore

# # Copy source
# COPY . .

# # Download Hugging Face interface file
# RUN mkdir -p src && wget -O src/custome_interface.py https://huggingface.co/Jzuluaga/accent-id-commonaccent_xlsr-en-english/resolve/main/custom_interface.py

# # Install Python dependencies
# RUN pip install --no-cache-dir -r requirements.txt --root-user-action=ignore

# # Expose Streamlit port
# EXPOSE 8501

# # Run Streamlit app
# CMD ["streamlit", "run", "streamlit_app.py", "--server.port=8501"]


FROM python:3.10-slim

# Set working directory
WORKDIR /app

# Install system packages and Ollama dependencies
RUN apt-get update && \
    apt-get install -y ffmpeg git wget curl gnupg && \
    rm -rf /var/lib/apt/lists/*

# Install Ollama
# Use the official install script for robust installation
RUN curl -fsSL https://ollama.com/install.sh | sh

# Set environment for proper model caching and permissions
ENV PYTHONUNBUFFERED=1
ENV HOME=/app
ENV XDG_CACHE_HOME=/app/.cache
ENV SPEECHBRAIN_CACHE=/app/.cache/speechbrain

# Create all needed directories with write permissions
RUN mkdir -p /app/pretrained_models \
    /app/wav2vec2_checkpoints \
    /app/pretrained_asr \
    /app/.cache/whisper \
    /app/.cache/speechbrain \
    /app/tmp \
    && chmod -R 777 /app

# Upgrade pip
RUN pip install --no-cache-dir --upgrade pip --root-user-action=ignore

# Copy source
COPY . .

# Copy the startup script and make it executable
COPY start.sh /usr/local/bin/start.sh
RUN chmod +x /usr/local/bin/start.sh

# Download Hugging Face interface file
RUN mkdir -p src && wget -O src/custome_interface.py https://huggingface.co/Jzuluaga/accent-id-commonaccent_xlsr-en-english/resolve/main/custom_interface.py

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt --root-user-action=ignore

# Expose both Streamlit and Ollama ports (for internal communication within Docker, if needed)
# Hugging Face Spaces will likely only expose the main Streamlit port
EXPOSE 8501 11434

# Use the startup script as the CMD
CMD ["/usr/local/bin/start.sh"]