dynamo/container/Dockerfile.test

26 lines
1.0 KiB
Docker

# syntax=docker/dockerfile:1.10.0-labs
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# Standalone test image — layers test deps on top of a pre-built runtime image.
# Usage: docker build -f container/Dockerfile.test --build-arg BASE_IMAGE=<runtime-image> .
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
# Install test dependencies on top of runtime image
USER root
RUN --mount=type=bind,source=./container/deps/requirements.test.txt,target=/tmp/requirements.test.txt \
--mount=type=cache,target=/root/.cache/uv \
--mount=type=cache,target=/root/.cache/pip,sharing=locked \
export UV_CACHE_DIR=/root/.cache/uv UV_GIT_LFS=1 UV_HTTP_TIMEOUT=300 UV_HTTP_RETRIES=5 && \
export PIP_CACHE_DIR=/root/.cache/pip && \
if [ -n "$VIRTUAL_ENV" ]; then \
uv pip install \
--requirement /tmp/requirements.test.txt; \
else \
pip install --break-system-packages \
--requirement /tmp/requirements.test.txt; \
fi
USER dynamo