crackuser commited on
Commit
7ca476f
·
verified ·
1 Parent(s): 313043c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -34
Dockerfile CHANGED
@@ -1,71 +1,48 @@
1
  FROM python:3.10-slim
2
 
3
- # Set working directory
4
  WORKDIR /app
5
 
6
- # Set environment variables to prevent interactive prompts
7
- ENV DEBIAN_FRONTEND=noninteractive
8
- ENV TZ=UTC
9
-
10
- # Install system dependencies
11
  RUN apt-get update && apt-get install -y \
12
  build-essential \
13
  curl \
14
  git \
15
  libsndfile1 \
16
  ffmpeg \
 
17
  && apt-get clean \
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
- # Copy requirements first for better caching
21
  COPY requirements.txt .
22
-
23
- # Install Python dependencies
24
  RUN pip install --no-cache-dir --upgrade pip
25
  RUN pip install --no-cache-dir -r requirements.txt
26
 
27
- # Copy application code
28
  COPY . .
29
 
30
- # Create .streamlit directory and config file
31
  RUN mkdir -p .streamlit
32
-
33
- # Create Streamlit config to fix 403 errors
34
  RUN echo '[server]\n\
35
  enableXsrfProtection = false\n\
36
  enableCORS = false\n\
37
- maxUploadSize = 400\n\
38
  headless = true\n\
39
  port = 7860\n\
40
  address = "0.0.0.0"\n\
41
  \n\
42
  [browser]\n\
43
- gatherUsageStats = false\n\
44
- \n\
45
- [theme]\n\
46
- primaryColor = "#667eea"\n\
47
- backgroundColor = "#FFFFFF"\n\
48
- secondaryBackgroundColor = "#f0f2f6"\n\
49
- textColor = "#262730"' > .streamlit/config.toml
50
 
51
- # Create non-root user for security
52
- RUN useradd -m -u 1000 streamlit && \
53
- chown -R streamlit:streamlit /app
54
  USER streamlit
55
 
56
- # Expose port for Hugging Face Spaces
57
  EXPOSE 7860
58
 
59
- # Set environment variables for Streamlit
60
  ENV STREAMLIT_SERVER_HEADLESS=true
61
  ENV STREAMLIT_SERVER_ENABLECORS=false
62
- ENV STREAMLIT_SERVER_ENABLEXSRFPROTECTION=false
63
- ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
64
  ENV STREAMLIT_SERVER_PORT=7860
 
65
 
66
- # Health check
67
- HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
68
- CMD curl -f http://localhost:7860/_stcore/health || exit 1
69
-
70
- # Run the application
71
- CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.fileWatcherType=none", "--browser.gatherUsageStats=false"]
 
1
  FROM python:3.10-slim
2
 
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies for audio processing
 
 
 
 
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  curl \
9
  git \
10
  libsndfile1 \
11
  ffmpeg \
12
+ libavcodec-extra \
13
  && apt-get clean \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
+ # Copy requirements and install Python packages
17
  COPY requirements.txt .
 
 
18
  RUN pip install --no-cache-dir --upgrade pip
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # Copy application
22
  COPY . .
23
 
24
+ # Create Streamlit config
25
  RUN mkdir -p .streamlit
 
 
26
  RUN echo '[server]\n\
27
  enableXsrfProtection = false\n\
28
  enableCORS = false\n\
29
+ maxUploadSize = 200\n\
30
  headless = true\n\
31
  port = 7860\n\
32
  address = "0.0.0.0"\n\
33
  \n\
34
  [browser]\n\
35
+ gatherUsageStats = false' > .streamlit/config.toml
 
 
 
 
 
 
36
 
37
+ # Create non-root user
38
+ RUN useradd -m -u 1000 streamlit && chown -R streamlit:streamlit /app
 
39
  USER streamlit
40
 
 
41
  EXPOSE 7860
42
 
 
43
  ENV STREAMLIT_SERVER_HEADLESS=true
44
  ENV STREAMLIT_SERVER_ENABLECORS=false
 
 
45
  ENV STREAMLIT_SERVER_PORT=7860
46
+ ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
47
 
48
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]