Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +14 -6
Dockerfile
CHANGED
@@ -1,19 +1,27 @@
|
|
|
|
1 |
FROM python:3.9-slim
|
2 |
|
3 |
-
#
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
WORKDIR /app
|
6 |
-
RUN chown appuser:appuser /app
|
7 |
-
USER appuser
|
8 |
|
9 |
# Copy the requirements file into the container
|
10 |
-
COPY
|
11 |
|
12 |
# Install any needed packages specified in requirements.txt
|
13 |
RUN pip install --no-cache-dir -r requirements.txt
|
14 |
|
15 |
# Copy the current directory contents into the container
|
16 |
-
COPY
|
|
|
|
|
|
|
17 |
|
18 |
# Expose port 7860 (default port for Gradio)
|
19 |
EXPOSE 7860
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
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 |
# Install any needed packages specified in requirements.txt
|
18 |
RUN pip install --no-cache-dir -r requirements.txt
|
19 |
|
20 |
# Copy the current directory contents into the container
|
21 |
+
COPY . .
|
22 |
+
|
23 |
+
# Pre-download the model during the build process
|
24 |
+
RUN python download_model.py
|
25 |
|
26 |
# Expose port 7860 (default port for Gradio)
|
27 |
EXPOSE 7860
|