-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile.dev
More file actions
43 lines (35 loc) · 1.52 KB
/
Dockerfile.dev
File metadata and controls
43 lines (35 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Development Dockerfile for the MLPerf Inference Endpoint Benchmarking System
# From project root:
# docker build -f scripts/Dockerfile.dev --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) -t inference-endpoint-dev .
# docker run -v $(pwd):/mnt/inference-endpoint -it --shm-size=512m inference-endpoint-dev bash
FROM python:3.12.11-slim
# Copy uv binary from official image
COPY --from=ghcr.io/astral-sh/uv:0.7.6 /uv /uvx /bin/
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
UV_PROJECT_ENVIRONMENT=/opt/venv
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential procps \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir /mnt/inference-endpoint
WORKDIR /mnt/inference-endpoint
# Copy lockfile + project metadata first for Docker layer caching
COPY pyproject.toml uv.lock .python-version ./
COPY src/ ./src/
# Create a non-root user for security
# Accept UID and GID as build arguments to match host user
ARG USER_ID=1000
ARG GROUP_ID=1000
RUN if ! getent group ${GROUP_ID}; then \
groupadd -g ${GROUP_ID} appuser; \
fi && \
useradd -u ${USER_ID} -g ${GROUP_ID} --create-home --shell /bin/bash appuser --no-log-init && \
chown -R ${USER_ID}:${GROUP_ID} /mnt/inference-endpoint && \
mkdir -p /opt/venv && chown ${USER_ID}:${GROUP_ID} /opt/venv
USER appuser
ENV PATH="/opt/venv/bin:/home/appuser/.local/bin:$PATH"
RUN uv sync --frozen --extra dev --extra test