Update Dockerfile
Browse files- Dockerfile +12 -3
Dockerfile
CHANGED
@@ -1,5 +1,9 @@
|
|
1 |
FROM python:3.9-slim
|
2 |
|
|
|
|
|
|
|
|
|
3 |
# Install system dependencies
|
4 |
RUN apt-get update && \
|
5 |
apt-get install -y \
|
@@ -13,13 +17,18 @@ RUN apt-get update && \
|
|
13 |
|
14 |
WORKDIR /app
|
15 |
|
|
|
|
|
|
|
|
|
|
|
16 |
# Install Python dependencies
|
17 |
COPY requirements.txt .
|
18 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
19 |
|
20 |
-
# Test model download
|
21 |
RUN python -c "from transformers import GPT2LMHeadModel; \
|
22 |
-
GPT2LMHeadModel.from_pretrained('gpt2-medium',
|
23 |
|
24 |
COPY . .
|
25 |
|
|
|
1 |
FROM python:3.9-slim
|
2 |
|
3 |
+
# Create cache directory with proper permissions
|
4 |
+
RUN mkdir -p /app/.cache && \
|
5 |
+
chmod 777 /app/.cache
|
6 |
+
|
7 |
# Install system dependencies
|
8 |
RUN apt-get update && \
|
9 |
apt-get install -y \
|
|
|
17 |
|
18 |
WORKDIR /app
|
19 |
|
20 |
+
# Set environment variables for Hugging Face
|
21 |
+
ENV TRANSFORMERS_CACHE=/app/.cache \
|
22 |
+
HF_DATASETS_CACHE=/app/.cache \
|
23 |
+
XDG_CACHE_HOME=/app/.cache
|
24 |
+
|
25 |
# Install Python dependencies
|
26 |
COPY requirements.txt .
|
27 |
+
RUN pip install --no-cache-dir -r requirements.txt --mkdir
|
28 |
|
29 |
+
# Test model download with proper cache
|
30 |
RUN python -c "from transformers import GPT2LMHeadModel; \
|
31 |
+
GPT2LMHeadModel.from_pretrained('gpt2-medium', local_files_only=False)"
|
32 |
|
33 |
COPY . .
|
34 |
|