2023-03-26 18:18:18 -07:00
|
|
|
# See tests/README.md for instructions on how to run the tests.
|
|
|
|
|
|
|
|
|
|
# tl;dr:
|
|
|
|
|
# Run the following command in the adaptive-lighting repo folder to run the tests:
|
|
|
|
|
# docker run -v $(pwd):/app basnijholt/adaptive-lighting:latest
|
|
|
|
|
|
|
|
|
|
# Optionally build the image yourself with:
|
|
|
|
|
# docker build -t basnijholt/adaptive-lighting:latest .
|
|
|
|
|
|
2025-06-15 21:31:51 -07:00
|
|
|
FROM ghcr.io/astral-sh/uv:debian
|
2023-03-26 18:18:18 -07:00
|
|
|
|
2025-11-27 09:06:41 -08:00
|
|
|
# Install build dependencies for Python extensions
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
|
python3-dev \
|
|
|
|
|
build-essential \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
2023-03-26 18:18:18 -07:00
|
|
|
# Clone home-assistant/core
|
2024-04-06 11:25:47 +02:00
|
|
|
RUN git clone --depth 1 --branch dev https://github.com/home-assistant/core.git /core
|
2023-03-26 18:18:18 -07:00
|
|
|
|
2023-06-12 00:33:07 +02:00
|
|
|
# Copy the Adaptive Lighting repository
|
|
|
|
|
COPY . /app/
|
2023-03-26 18:18:18 -07:00
|
|
|
|
|
|
|
|
# Setup symlinks in core
|
2024-04-07 14:01:05 +02:00
|
|
|
RUN ln -s /core /app/core && /app/scripts/setup-symlinks
|
2023-03-26 18:18:18 -07:00
|
|
|
|
2024-04-06 11:25:47 +02:00
|
|
|
# Install home-assistant/core dependencies
|
2025-06-15 22:33:35 -07:00
|
|
|
RUN mkdir -p /.venv
|
|
|
|
|
ENV UV_PROJECT_ENVIRONMENT=/.venv UV_PYTHON=3.13 PATH="/.venv/bin:$PATH"
|
2025-06-15 21:31:51 -07:00
|
|
|
RUN uv venv
|
2025-06-15 22:28:12 -07:00
|
|
|
RUN /app/scripts/setup-dependencies
|
2023-03-26 18:18:18 -07:00
|
|
|
|
2025-06-15 21:31:51 -07:00
|
|
|
WORKDIR /app/core
|
2023-03-26 18:18:18 -07:00
|
|
|
|
2023-06-12 00:33:07 +02:00
|
|
|
# Make 'custom_components/adaptive_lighting' imports available to tests
|
|
|
|
|
ENV PYTHONPATH="${PYTHONPATH}:/app"
|
|
|
|
|
|
2026-01-11 12:44:45 -08:00
|
|
|
# Entrypoint sets up symlinks at runtime (needed because volume mount overwrites build-time symlinks)
|
|
|
|
|
ENTRYPOINT ["/app/scripts/docker-entrypoint.sh"]
|
2023-03-26 22:07:07 -07:00
|
|
|
|
|
|
|
|
# Run tests in the 'tests/components/adaptive_lighting' directory
|
|
|
|
|
CMD ["tests/components/adaptive_lighting"]
|