Hwandji commited on
Commit
6c577c8
·
1 Parent(s): 795dc9a

fix(docker): reorder COPY commands for HuggingFace build context

Browse files

PROBLEM:
- HuggingFace build failing with: '/huggingface/supervisord.conf': not found
- Docker layer caching was invalidating when backend code changed
- Config files copied AFTER backend, causing cache miss

FIX:
- Reordered COPY commands: configs → frontend → backend
- Ensures HuggingFace configs cached early in build
- Optimizes Docker layer caching (least-to-most frequently changed)

BENEFITS:
- Fixes HuggingFace deployment build failure
- Better cache utilization (faster builds)
- More resilient to code changes

Files changed (1) hide show
  1. huggingface/Dockerfile +8 -5
huggingface/Dockerfile CHANGED
@@ -38,16 +38,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
38
  # Stage 2: Copy Application Code
39
  # ==========================================
40
 
41
- # Copy backend code
42
- COPY backend/ /app/backend/
43
  COPY requirements.txt /app/
44
 
 
 
 
 
 
45
  # Copy frontend code
46
  COPY frontend/ /app/frontend/
47
 
48
- # Copy HuggingFace specific configs
49
- COPY huggingface/nginx.conf /etc/nginx/nginx.conf
50
- COPY huggingface/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
51
 
52
  # ==========================================
53
  # Stage 3: Install Python Dependencies
 
38
  # Stage 2: Copy Application Code
39
  # ==========================================
40
 
41
+ # Copy requirements.txt first (changes least frequently)
 
42
  COPY requirements.txt /app/
43
 
44
+ # Copy HuggingFace specific configs BEFORE application code
45
+ # (these rarely change, so they should be cached early)
46
+ COPY huggingface/nginx.conf /etc/nginx/nginx.conf
47
+ COPY huggingface/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
48
+
49
  # Copy frontend code
50
  COPY frontend/ /app/frontend/
51
 
52
+ # Copy backend code (changes most frequently, so copy last)
53
+ COPY backend/ /app/backend/
 
54
 
55
  # ==========================================
56
  # Stage 3: Install Python Dependencies