Spaces:
Running
Running
amaye15
commited on
Commit
·
c50b85f
1
Parent(s):
20998ce
Debug - UV
Browse files- Dockerfile +8 -5
Dockerfile
CHANGED
@@ -56,7 +56,7 @@ FROM python:3.12-slim as builder
|
|
56 |
# Set environment variables
|
57 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
58 |
PYTHONUNBUFFERED=1 \
|
59 |
-
PATH="/
|
60 |
|
61 |
# Install system dependencies (curl and ca-certificates for uv installer)
|
62 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
@@ -73,10 +73,13 @@ RUN useradd -m -u 1000 user
|
|
73 |
# Set the working directory
|
74 |
WORKDIR /app
|
75 |
|
|
|
|
|
|
|
76 |
# Copy only the requirements file first to leverage Docker cache
|
77 |
COPY --chown=user ./requirements.txt /app/requirements.txt
|
78 |
|
79 |
-
# Install dependencies using uv
|
80 |
RUN uv pip install --no-cache-dir -r requirements.txt
|
81 |
|
82 |
# Copy the rest of the application code
|
@@ -90,14 +93,14 @@ RUN useradd -m -u 1000 user
|
|
90 |
USER user
|
91 |
|
92 |
# Set environment variables
|
93 |
-
ENV PATH="/
|
94 |
PYTHONUNBUFFERED=1
|
95 |
|
96 |
# Set the working directory
|
97 |
WORKDIR /app
|
98 |
|
99 |
-
# Copy the virtual environment
|
100 |
-
COPY --from=builder --chown=user /
|
101 |
|
102 |
# Copy only the necessary files from the builder stage
|
103 |
COPY --from=builder --chown=user /app /app
|
|
|
56 |
# Set environment variables
|
57 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
58 |
PYTHONUNBUFFERED=1 \
|
59 |
+
PATH="/opt/venv/bin:$PATH"
|
60 |
|
61 |
# Install system dependencies (curl and ca-certificates for uv installer)
|
62 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
73 |
# Set the working directory
|
74 |
WORKDIR /app
|
75 |
|
76 |
+
# Create a virtual environment
|
77 |
+
RUN uv venv /opt/venv
|
78 |
+
|
79 |
# Copy only the requirements file first to leverage Docker cache
|
80 |
COPY --chown=user ./requirements.txt /app/requirements.txt
|
81 |
|
82 |
+
# Install dependencies into the virtual environment using uv
|
83 |
RUN uv pip install --no-cache-dir -r requirements.txt
|
84 |
|
85 |
# Copy the rest of the application code
|
|
|
93 |
USER user
|
94 |
|
95 |
# Set environment variables
|
96 |
+
ENV PATH="/opt/venv/bin:$PATH" \
|
97 |
PYTHONUNBUFFERED=1
|
98 |
|
99 |
# Set the working directory
|
100 |
WORKDIR /app
|
101 |
|
102 |
+
# Copy the virtual environment from the builder stage
|
103 |
+
COPY --from=builder --chown=user /opt/venv /opt/venv
|
104 |
|
105 |
# Copy only the necessary files from the builder stage
|
106 |
COPY --from=builder --chown=user /app /app
|