arnel8888 commited on
Commit
2c78cf8
·
verified ·
1 Parent(s): cc8152f

Updated Dockerfile to resolve cache issues

Browse files
Files changed (1) hide show
  1. Dockerfile +37 -30
Dockerfile CHANGED
@@ -1,31 +1,38 @@
1
- # Use Python 3.13 slim as the base image
2
- FROM python:3.13-slim
3
-
4
- # Install git and other necessary packages
5
- RUN apt-get update && apt-get install -y \
6
- git \
7
- && rm -rf /var/lib/apt/lists/*
8
-
9
- # Expose the secret GROQ_API_KEY at buildtime and use its value as git remote URL
10
- RUN --mount=type=secret,id=GROQ_API_KEY,mode=0444,required=true \
11
- git init && \
12
- git remote add origin $(cat /run/secrets/GROQ_API_KEY)
13
-
14
- # Set the working directory
15
- WORKDIR /app
16
-
17
- # Copy app folder
18
- COPY app/ .
19
-
20
- # Copy requirements and install
21
- COPY requirements.txt .
22
- RUN pip install --no-cache-dir -r requirements.txt
23
-
24
- # Download the BGE embedding model
25
- RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('BAAI/bge-small-en-v1.5')"
26
-
27
- # Expose Gradio's default port
28
- EXPOSE 7860
29
-
30
- # Run the app
 
 
 
 
 
 
 
31
  CMD ["python", "app.py"]
 
1
+ # Use Python 3.13 slim as the base image
2
+ FROM python:3.13-slim
3
+
4
+ # Install git and other necessary packages
5
+ RUN apt-get update && apt-get install -y \
6
+ git \
7
+ && rm -rf /var/lib/apt/lists/*
8
+
9
+ # Expose the secret GROQ_API_KEY at buildtime and use its value as git remote URL
10
+ RUN --mount=type=secret,id=GROQ_API_KEY,mode=0444,required=true \
11
+ git init && \
12
+ git remote add origin $(cat /run/secrets/GROQ_API_KEY)
13
+
14
+ # Set the working directory
15
+ WORKDIR /app
16
+
17
+ # Create cache directory with proper permissions
18
+ RUN mkdir -p /.cache && chmod 777 /.cache
19
+
20
+ # Set environment variable for transformers cache
21
+ ENV TRANSFORMERS_CACHE=/.cache/transformers
22
+ ENV HF_HOME=/.cache/huggingface
23
+
24
+ # Copy requirements and install
25
+ COPY requirements.txt .
26
+ RUN pip install --no-cache-dir -r requirements.txt
27
+
28
+ # Download the BGE embedding model
29
+ RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('BAAI/bge-small-en-v1.5')"
30
+
31
+ # Copy app folder
32
+ COPY app/ .
33
+
34
+ # Expose Gradio's default port
35
+ EXPOSE 7860
36
+
37
+ # Run the app
38
  CMD ["python", "app.py"]