norhan12 commited on
Commit
c3a988d
·
verified ·
1 Parent(s): b768dad

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +54 -54
Dockerfile CHANGED
@@ -1,54 +1,54 @@
1
- FROM python:3.10-slim
2
-
3
- # 1. Install system dependencies from your old file
4
- RUN apt-get update && apt-get install -y \
5
- libsndfile1 \
6
- ffmpeg \
7
- sox \
8
- curl \
9
- git-lfs \
10
- pkg-config \
11
- libfreetype6-dev \
12
- libpng-dev \
13
- build-essential \
14
- && rm -rf /var/lib/apt/lists/*
15
-
16
- # 2. Create non-root user
17
- RUN useradd -m appuser
18
-
19
- # 3. Create directory structure (with proper ownership)
20
- RUN mkdir -p \
21
- /tmp/matplotlib \
22
- /tmp/fontconfig \
23
- /tmp/lhotse \
24
- /app/uploads \
25
- /app/processed_audio \
26
- /app/assets && \
27
- chown -R appuser:appuser /app /tmp/matplotlib /tmp/fontconfig /tmp/lhotse
28
-
29
- # 4. Set working directory
30
- WORKDIR /app
31
-
32
- # 5. Copy application files with correct ownership
33
- COPY --chown=appuser:appuser . .
34
-
35
- # 6. Set environment variables from your old file
36
- ENV MPLCONFIGDIR=/tmp/matplotlib \
37
- FONTCONFIG_PATH=/tmp/fontconfig \
38
- LHOTSE_CACHE_DIR=/tmp/lhotse \
39
- HF_HUB_ENABLE_HF_TRANSFER=1 \
40
- PYTHONUNBUFFERED=1
41
-
42
- # 7. Install Python dependencies as non-root user
43
- USER appuser
44
- RUN pip install --upgrade pip && \
45
- pip install --no-cache-dir -r requirements.txt && \
46
- python -m spacy download en_core_web_sm && \
47
- pip check
48
-
49
- # 8. Health check - MODIFIED to use the new /health endpoint
50
- HEALTHCHECK --interval=30s --timeout=10s \
51
- CMD curl -f http://localhost:7860/health || exit 1
52
-
53
- # 9. Run the application - MODIFIED to use Uvicorn for FastAPI
54
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.10-slim
2
+
3
+ # 1. Install system dependencies from your old file
4
+ RUN apt-get update && apt-get install -y \
5
+ libsndfile1 \
6
+ ffmpeg \
7
+ sox \
8
+ curl \
9
+ git-lfs \
10
+ pkg-config \
11
+ libfreetype6-dev \
12
+ libpng-dev \
13
+ build-essential \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # 2. Create non-root user
17
+ RUN useradd -m appuser
18
+
19
+ # 3. Create directory structure (with proper ownership)
20
+ RUN mkdir -p \
21
+ /tmp/matplotlib \
22
+ /tmp/fontconfig \
23
+ /tmp/lhotse \
24
+ /app/uploads \
25
+ /app/processed_audio \
26
+ /app/assets && \
27
+ chown -R appuser:appuser /app /tmp/matplotlib /tmp/fontconfig /tmp/lhotse
28
+
29
+ # 4. Set working directory
30
+ WORKDIR /app
31
+
32
+ # 5. Copy application files with correct ownership
33
+ COPY --chown=appuser:appuser . .
34
+
35
+ # 6. Set environment variables from your old file
36
+ ENV MPLCONFIGDIR=/tmp/matplotlib \
37
+ FONTCONFIG_PATH=/tmp/fontconfig \
38
+ LHOTSE_CACHE_DIR=/tmp/lhotse \
39
+ HF_HUB_ENABLE_HF_TRANSFER=1 \
40
+ PYTHONUNBUFFERED=1
41
+
42
+ # 7. Install Python dependencies as non-root user
43
+ USER appuser
44
+ RUN pip install --upgrade pip && \
45
+ pip install --no-cache-dir -r requirements.txt && \
46
+ python -m spacy download en_core_web_sm && \
47
+ pip check
48
+
49
+ # 8. Health check - MODIFIED to use the new /health endpoint
50
+ HEALTHCHECK --interval=30s --timeout=10s \
51
+ CMD curl -f http://localhost:7860/health || exit 1
52
+
53
+ # 9. Run the application - MODIFIED to use Uvicorn for FastAPI
54
+ CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]