aaryan24 commited on
Commit
d39833b
·
verified ·
1 Parent(s): b18f4a0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +35 -34
Dockerfile CHANGED
@@ -1,34 +1,35 @@
1
- FROM python:3.10-slim
2
-
3
- # Set environment variables for Hugging Face cache
4
- ENV HF_HOME=/code/hf_cache
5
- ENV TRANSFORMERS_CACHE=/code/hf_cache
6
- ENV PYTHONDONTWRITEBYTECODE=1
7
- ENV PYTHONUNBUFFERED=1
8
-
9
- # Create working directory
10
- WORKDIR /code
11
-
12
- # System dependencies
13
- RUN apt-get update && apt-get install -y \
14
- git \
15
- wget \
16
- build-essential \
17
- && rm -rf /var/lib/apt/lists/*
18
-
19
- # Install Python packages
20
- COPY requirements.txt .
21
- RUN pip install --no-cache-dir --upgrade pip \
22
- && pip install --no-cache-dir -r requirements.txt
23
-
24
- # Copy app code
25
- COPY . .
26
-
27
- # Create model cache directory
28
- RUN mkdir -p /code/hf_cache
29
-
30
- # Expose FastAPI port
31
- EXPOSE 7860
32
-
33
- # Start the app
34
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
+ FROM python:3.10-slim
2
+
3
+ # Set environment variables for Hugging Face cache
4
+ # Before running your app
5
+ ENV HF_HOME=/app/hf_cache
6
+ ENV TRANSFORMERS_CACHE=/app/hf_cache
7
+ ENV XDG_CACHE_HOME=/app/hf_cache
8
+ RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache
9
+
10
+ # Create working directory
11
+ WORKDIR /code
12
+
13
+ # System dependencies
14
+ RUN apt-get update && apt-get install -y \
15
+ git \
16
+ wget \
17
+ build-essential \
18
+ && rm -rf /var/lib/apt/lists/*
19
+
20
+ # Install Python packages
21
+ COPY requirements.txt .
22
+ RUN pip install --no-cache-dir --upgrade pip \
23
+ && pip install --no-cache-dir -r requirements.txt
24
+
25
+ # Copy app code
26
+ COPY . .
27
+
28
+ # Create model cache directory
29
+ RUN mkdir -p /code/hf_cache
30
+
31
+ # Expose FastAPI port
32
+ EXPOSE 7860
33
+
34
+ # Start the app
35
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]