Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +10 -17
Dockerfile
CHANGED
@@ -1,27 +1,20 @@
|
|
1 |
-
#
|
2 |
-
FROM python:3.9-slim
|
3 |
-
|
4 |
-
# Set environment variables for Hugging Face cache
|
5 |
-
ENV TRANSFORMERS_CACHE=/app/.cache
|
6 |
-
ENV HF_DATASETS_CACHE=/app/.cache
|
7 |
-
|
8 |
-
# Create the cache directory
|
9 |
-
RUN mkdir -p /app/.cache
|
10 |
|
11 |
-
# Set the working directory in the container
|
12 |
WORKDIR /app
|
13 |
-
|
14 |
-
# Copy the requirements file into the container
|
15 |
COPY requirements.txt .
|
|
|
16 |
|
17 |
-
#
|
18 |
-
|
|
|
19 |
|
20 |
-
# Copy the
|
|
|
21 |
COPY . .
|
22 |
|
23 |
-
#
|
24 |
-
|
25 |
|
26 |
# Expose port 7860 (default port for Gradio)
|
27 |
EXPOSE 7860
|
|
|
1 |
+
# Stage 1: Build
|
2 |
+
FROM python:3.9-slim as builder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
|
|
4 |
WORKDIR /app
|
|
|
|
|
5 |
COPY requirements.txt .
|
6 |
+
RUN pip install --no-cache-dir --user -r requirements.txt
|
7 |
|
8 |
+
# Stage 2: Final Image
|
9 |
+
FROM python:3.9-slim
|
10 |
+
WORKDIR /app
|
11 |
|
12 |
+
# Copy only the necessary files from the builder stage
|
13 |
+
COPY --from=builder /root/.local /root/.local
|
14 |
COPY . .
|
15 |
|
16 |
+
# Ensure scripts in .local are usable
|
17 |
+
ENV PATH=/root/.local/bin:$PATH
|
18 |
|
19 |
# Expose port 7860 (default port for Gradio)
|
20 |
EXPOSE 7860
|