Skip to content

Commit d755db9

Browse files
committed
Use uv for dependency installation in Dockerfile
Install uv from distroless image (pinned), set UV_SYSTEM_PYTHON and UV_COMPILE_BYTECODE, and replace pip with uv pip install for requirements.
1 parent b1ed11c commit d755db9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# syntax=docker/dockerfile:1
22
FROM python:3.12-slim AS base
33

4+
# Install uv (pinned) from official distroless image so it's on PATH
5+
COPY --from=ghcr.io/astral-sh/uv:0.8.15 /uv /uvx /bin/
6+
47
ENV PYTHONDONTWRITEBYTECODE=1 \
58
PYTHONUNBUFFERED=1 \
69
PYTHONIOENCODING=UTF-8 \
710
PIP_NO_CACHE_DIR=1 \
811
LOGLEVEL=WARNING \
912
NO_COLOR=1 \
1013
ZENML_LOGGING_COLORS_DISABLED=true \
11-
ZENML_ENABLE_RICH_TRACEBACK=false
14+
ZENML_ENABLE_RICH_TRACEBACK=false \
15+
UV_SYSTEM_PYTHON=1 \
16+
UV_COMPILE_BYTECODE=1
1217

1318
# Optional but helpful: fresh CA certs for TLS reliability
1419
RUN apt-get update \
@@ -19,8 +24,7 @@ WORKDIR /app
1924

2025
# Install Python dependencies
2126
COPY requirements.txt /app/
22-
RUN pip install --upgrade pip setuptools wheel \
23-
&& pip install -r requirements.txt
27+
RUN uv pip install -r requirements.txt
2428

2529
# Security: non-root user
2630
RUN useradd -m -u 10001 appuser

0 commit comments

Comments
 (0)