yalsaffar commited on
Commit
ef46c24
·
1 Parent(s): 86fb693

Updated Dockerfile for Hugging Face Spaces deployment

Browse files
Files changed (2) hide show
  1. Dockerfile +9 -6
  2. app/server.js +1 -1
Dockerfile CHANGED
@@ -44,13 +44,13 @@ ENV PATH=${CUDA_HOME}/bin:${PATH}
44
  # Optionally set LD_LIBRARY_PATH for CUDA libraries
45
  ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
46
 
47
- # Create cache directory
48
- RUN mkdir -p /app/cache/huggingface
49
- RUN mkdir -p /app/cache/triton
50
- RUN mkdir -p /app/cache/torch_extensions
51
- RUN chmod -R 777 /app/cache
52
 
53
- # Set environment variables for cache directory
54
  ENV HF_HOME=/app/cache/huggingface
55
  ENV TRANSFORMERS_CACHE=/app/cache/huggingface
56
  ENV TRITON_CACHE_DIR=/app/cache/triton
@@ -69,6 +69,9 @@ RUN chmod +x setup.sh
69
  # Copy the application code into the container
70
  COPY . /app
71
 
 
 
 
72
  # Copy wait-for-it script
73
  COPY wait-for-it.sh /app/wait-for-it.sh
74
 
 
44
  # Optionally set LD_LIBRARY_PATH for CUDA libraries
45
  ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
46
 
47
+ # Create cache directories with proper permissions
48
+ RUN mkdir -p /app/cache/huggingface && \
49
+ mkdir -p /app/cache/triton && \
50
+ mkdir -p /app/cache/torch_extensions && \
51
+ chmod -R 777 /app/cache
52
 
53
+ # Set environment variables for cache directories
54
  ENV HF_HOME=/app/cache/huggingface
55
  ENV TRANSFORMERS_CACHE=/app/cache/huggingface
56
  ENV TRITON_CACHE_DIR=/app/cache/triton
 
69
  # Copy the application code into the container
70
  COPY . /app
71
 
72
+ # Create necessary directories for Node.js uploads with proper permissions
73
+ RUN mkdir -p /app/app/uploads && chmod -R 777 /app/app/uploads
74
+
75
  # Copy wait-for-it script
76
  COPY wait-for-it.sh /app/wait-for-it.sh
77
 
app/server.js CHANGED
@@ -11,7 +11,7 @@ const port = 3000;
11
 
12
  const uploadsDir = path.join(__dirname, 'uploads');
13
  if (!fs.existsSync(uploadsDir)) {
14
- fs.mkdirSync(uploadsDir);
15
  }
16
 
17
  const storage = multer.memoryStorage();
 
11
 
12
  const uploadsDir = path.join(__dirname, 'uploads');
13
  if (!fs.existsSync(uploadsDir)) {
14
+ fs.mkdirSync(uploadsDir, { recursive: true });
15
  }
16
 
17
  const storage = multer.memoryStorage();