norhan12 commited on
Commit
e525d61
·
verified ·
1 Parent(s): 2995e64

Update docker

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -9
Dockerfile CHANGED
@@ -27,26 +27,26 @@ RUN mkdir -p \
27
 
28
  WORKDIR /app
29
 
30
- COPY --chown=appuser:appuser . .
31
-
32
  ENV MPLCONFIGDIR=/tmp/matplotlib \
33
  FONTCONFIG_PATH=/tmp/fontconfig \
34
  LHOTSE_CACHE_DIR=/tmp/lhotse \
35
  HF_HUB_ENABLE_HF_TRANSFER=1 \
36
  PYTHONUNBUFFERED=1
37
-
38
 
39
- # 7. Install Python dependencies as non-root user
 
 
40
  USER appuser
 
 
41
  RUN pip install --upgrade pip && \
42
  pip install --no-cache-dir -r requirements.txt && \
43
- python -m spacy download en_core_web_sm && \
44
- pip check
 
 
45
 
46
- # 8. Health check - MODIFIED to use the new /health endpoint
47
  HEALTHCHECK --interval=30s --timeout=10s \
48
  CMD curl -f http://localhost:7860/health || exit 1
49
 
50
-
51
- # 9. Run the application - MODIFIED to use Uvicorn for FastAPI
52
  CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
27
 
28
  WORKDIR /app
29
 
 
 
30
  ENV MPLCONFIGDIR=/tmp/matplotlib \
31
  FONTCONFIG_PATH=/tmp/fontconfig \
32
  LHOTSE_CACHE_DIR=/tmp/lhotse \
33
  HF_HUB_ENABLE_HF_TRANSFER=1 \
34
  PYTHONUNBUFFERED=1
 
35
 
36
+ # --- OPTIMIZATION: Copy ONLY requirements first to leverage Docker caching ---
37
+ COPY --chown=appuser:appuser requirements.txt .
38
+
39
  USER appuser
40
+
41
+ # Install dependencies (Removed pip check temporarily for debugging)
42
  RUN pip install --upgrade pip && \
43
  pip install --no-cache-dir -r requirements.txt && \
44
+ python -m spacy download en_core_web_sm
45
+
46
+ # --- OPTIMIZATION: Copy the rest of the code AFTER dependencies are installed ---
47
+ COPY --chown=appuser:appuser . .
48
 
 
49
  HEALTHCHECK --interval=30s --timeout=10s \
50
  CMD curl -f http://localhost:7860/health || exit 1
51
 
 
 
52
  CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]