Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +17 -15
Dockerfile
CHANGED
@@ -1,30 +1,32 @@
|
|
1 |
-
#
|
2 |
-
FROM
|
3 |
|
4 |
-
# Set environment
|
5 |
ENV DEBIAN_FRONTEND=noninteractive
|
6 |
-
ENV
|
7 |
-
ENV UV_CACHE_DIR="/data/uv_cache"
|
8 |
|
9 |
-
#
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
13 |
|
14 |
-
# Install
|
15 |
-
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
|
16 |
RUN pip install uv
|
17 |
|
18 |
-
# Copy requirements and install them
|
|
|
19 |
COPY requirements.txt .
|
20 |
RUN uv pip install --no-cache --system -r requirements.txt
|
21 |
|
22 |
-
# Copy the application code
|
23 |
COPY ./app.py /app/app.py
|
24 |
WORKDIR /app
|
25 |
|
26 |
-
# Expose the port
|
27 |
EXPOSE 7860
|
28 |
|
29 |
-
#
|
30 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
+
# 1. Start from the official NVIDIA CUDA development image. This is the key change.
|
2 |
+
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
|
3 |
|
4 |
+
# 2. Set up the environment to be non-interactive and add Python paths
|
5 |
ENV DEBIAN_FRONTEND=noninteractive
|
6 |
+
ENV PATH="/root/.local/bin:${PATH}"
|
|
|
7 |
|
8 |
+
# 3. Install Python 3.11, pip, and other essential tools
|
9 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
10 |
+
python3.11 \
|
11 |
+
python3-pip \
|
12 |
+
python-is-python3 \
|
13 |
+
git \
|
14 |
+
&& rm -rf /var/lib/apt/lists/*
|
15 |
|
16 |
+
# 4. Install uv for fast package installation
|
|
|
17 |
RUN pip install uv
|
18 |
|
19 |
+
# 5. Copy requirements and install them.
|
20 |
+
# The base image is clean, so we need to install everything, including torch.
|
21 |
COPY requirements.txt .
|
22 |
RUN uv pip install --no-cache --system -r requirements.txt
|
23 |
|
24 |
+
# 6. Copy the application code
|
25 |
COPY ./app.py /app/app.py
|
26 |
WORKDIR /app
|
27 |
|
28 |
+
# 7. Expose the port
|
29 |
EXPOSE 7860
|
30 |
|
31 |
+
# 8. Run the application with uvicorn
|
32 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|