feliksius commited on
Commit
7a550d9
·
verified ·
1 Parent(s): 4996216

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -2
Dockerfile CHANGED
@@ -1,6 +1,10 @@
1
  # Use official Python 3.10 slim image for a smaller footprint
2
  FROM python:3.10-slim
3
 
 
 
 
 
4
  # Set working directory
5
  WORKDIR /app
6
 
@@ -10,14 +14,16 @@ COPY requirements.txt .
10
  # Install system dependencies and Python packages
11
  RUN apt-get update && apt-get install -y \
12
  gcc \
 
13
  && rm -rf /var/lib/apt/lists/* \
14
  && pip install --no-cache-dir -r requirements.txt
15
 
16
  # Copy application code
17
  COPY app.py .
18
 
19
- # Create cache directory for Hugging Face models
20
- RUN mkdir -p /app/cache && chmod -R 777 /app/cache
 
21
 
22
  # Expose port for FastAPI
23
  EXPOSE 8000
 
1
  # Use official Python 3.10 slim image for a smaller footprint
2
  FROM python:3.10-slim
3
 
4
+ # Set environment variable for Hugging Face cache
5
+ ENV TRANSFORMERS_CACHE=/app/cache
6
+ ENV HF_HOME=/app/cache
7
+
8
  # Set working directory
9
  WORKDIR /app
10
 
 
14
  # Install system dependencies and Python packages
15
  RUN apt-get update && apt-get install -y \
16
  gcc \
17
+ libgomp1 \ # Required for PyTorch
18
  && rm -rf /var/lib/apt/lists/* \
19
  && pip install --no-cache-dir -r requirements.txt
20
 
21
  # Copy application code
22
  COPY app.py .
23
 
24
+ # Create cache and logs directories with write permissions
25
+ RUN mkdir -p /app/cache /app/logs \
26
+ && chmod -R 777 /app/cache /app/logs
27
 
28
  # Expose port for FastAPI
29
  EXPOSE 8000