Commit
·
1c0efea
1
Parent(s):
e0fe2c9
does it solve the cache issue?
Browse files- Dockerfile +16 -1
Dockerfile
CHANGED
@@ -2,7 +2,6 @@
|
|
2 |
FROM python:3-slim
|
3 |
|
4 |
WORKDIR /usr/src/app
|
5 |
-
COPY . .
|
6 |
|
7 |
# Install git and clean up to keep the image small
|
8 |
RUN apt-get update && \
|
@@ -10,14 +9,30 @@ RUN apt-get update && \
|
|
10 |
apt-get clean && \
|
11 |
rm -rf /var/lib/apt/lists/*
|
12 |
|
|
|
|
|
|
|
|
|
13 |
# Install required dependencies
|
14 |
RUN pip install --upgrade pip
|
|
|
|
|
|
|
15 |
RUN pip install --no-cache-dir -r requirements.txt
|
16 |
|
|
|
|
|
|
|
17 |
# Make sft script executable
|
18 |
COPY sft.py /usr/local/bin/sft
|
19 |
RUN chmod +x /usr/local/bin/sft
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
# Start gradio application
|
22 |
EXPOSE 7860
|
23 |
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
|
|
2 |
FROM python:3-slim
|
3 |
|
4 |
WORKDIR /usr/src/app
|
|
|
5 |
|
6 |
# Install git and clean up to keep the image small
|
7 |
RUN apt-get update && \
|
|
|
9 |
apt-get clean && \
|
10 |
rm -rf /var/lib/apt/lists/*
|
11 |
|
12 |
+
# Create cache directories with world-writable permissions
|
13 |
+
RUN mkdir -p /.cache /root/.cache && \
|
14 |
+
chmod -R 777 /.cache /root/.cache
|
15 |
+
|
16 |
# Install required dependencies
|
17 |
RUN pip install --upgrade pip
|
18 |
+
|
19 |
+
# Copy requirements first for better caching
|
20 |
+
COPY requirements.txt .
|
21 |
RUN pip install --no-cache-dir -r requirements.txt
|
22 |
|
23 |
+
# Copy application files
|
24 |
+
COPY . .
|
25 |
+
|
26 |
# Make sft script executable
|
27 |
COPY sft.py /usr/local/bin/sft
|
28 |
RUN chmod +x /usr/local/bin/sft
|
29 |
|
30 |
+
# Set environment variables to use the writable cache
|
31 |
+
ENV XDG_CACHE_HOME=/.cache
|
32 |
+
ENV HF_HOME=/.cache/huggingface
|
33 |
+
ENV TRANSFORMERS_CACHE=/.cache/huggingface/transformers
|
34 |
+
ENV HF_DATASETS_CACHE=/.cache/huggingface/datasets
|
35 |
+
|
36 |
# Start gradio application
|
37 |
EXPOSE 7860
|
38 |
ENV GRADIO_SERVER_NAME="0.0.0.0"
|