FROM python:3.13-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1

# The add-on version changes for every release. Copying its config before the
# clone makes Docker invalidate the application layer instead of reusing old code.
COPY config.yaml /tmp/addon-config.yaml

RUN apt-get update \
    && apt-get install -y --no-install-recommends git \
    && git clone --depth 1 --branch main \
       http://192.168.6.31:3000/pino/sillyhome-next.git /app \
    && python -m pip install --upgrade pip \
    && python -m pip install /app \
    && rm -rf /var/lib/apt/lists/* /app/.git /tmp/addon-config.yaml

COPY run.sh /run.sh
RUN chmod 0755 /run.sh

EXPOSE 8000
CMD ["/run.sh"]
