blob: 7b6b927af71535f1f36b0ea6de5c0336ec6b9444 [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# Multi-stage build for Python SDK testing
FROM python:3.10-slim AS base
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Rust for maturin
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Install uv
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:${PATH}"
# Set working directory
WORKDIR /workspace
# Copy dependency files first for better layer caching
COPY Cargo.toml Cargo.lock ./
COPY foreign/python/Cargo.toml ./foreign/python/
COPY foreign/python/pyproject.toml ./foreign/python/
COPY foreign/python/uv.lock ./foreign/python/
COPY foreign/python/README.md ./foreign/python/
COPY foreign/python/LICENSE ./foreign/python/
COPY foreign/python/NOTICE ./foreign/python/
# Copy core dependencies (changes less frequently)
COPY core/ /workspace/core/
# Copy Python SDK source (changes more frequently)
COPY foreign/python/src/ ./src/
# Install dependencies and build extension using native uv workflow
WORKDIR /workspace/foreign/python
RUN uv sync --frozen --extra dev --extra testing
RUN uv run maturin develop
# Use the uv-managed virtual environment by default
ENV PATH="/workspace/foreign/python/.venv/bin:${PATH}"
# Copy test files
COPY foreign/python/tests/ ./tests/
# Create test script
COPY foreign/python/scripts/test.sh ./scripts/test.sh
RUN chmod +x ./scripts/test.sh
# Set environment variables
ENV PYTHONPATH=/workspace/foreign/python
ENV IGGY_SERVER_HOST=iggy-server
ENV IGGY_SERVER_TCP_PORT=8090
# Default command runs tests
CMD ["./scripts/test.sh"]