|
1 | 1 | # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile |
2 | 2 | ARG BUILD_FROM |
3 | | -FROM $BUILD_FROM as compiler |
4 | | -ARG TEMPIO_VERSION BUILD_ARCH |
| 3 | +FROM $BUILD_FROM AS builder |
5 | 4 |
|
6 | 5 | # renovate: datasource=github-releases depName=dmunozv04/iSponsorBlockTV |
7 | 6 | ARG ISPONSORBLOCKTV_VERSION=v2.6.1 |
8 | 7 |
|
9 | | -RUN curl -sSLf -o /usr/bin/tempio "https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}" |
10 | | -RUN apk add --no-cache uv git |
11 | | -ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy UV_PYTHON_DOWNLOADS=0 |
| 8 | +RUN apk add --no-cache uv git gcc musl-dev |
| 9 | + |
12 | 10 | WORKDIR /app |
13 | | -RUN git clone --branch ${ISPONSORBLOCKTV_VERSION} --depth 1 https://github.com/dmunozv04/iSponsorBlockTV /repo |
14 | | -RUN cp -r /repo/src/* /app/ && cp /repo/requirements.txt /app/ |
15 | | -# Install build dependencies temporarily (needed for aiohttp), matching upstream approach |
16 | | -RUN apk add --no-cache gcc musl-dev \ |
17 | | - && uv pip install --system --index-strategy unsafe-best-match -r requirements.txt \ |
18 | | - && apk del gcc musl-dev |
19 | | -# TODO: we need the below as UV_COMPILE_BYTECODE=1 is not working as expected, remove once fixed |
20 | | -RUN python3 -m compileall -b -f . && \ |
21 | | - find . -name "*.py" -type f -delete |
| 11 | +RUN git clone --branch ${ISPONSORBLOCKTV_VERSION} --depth 1 \ |
| 12 | + https://github.com/dmunozv04/iSponsorBlockTV . |
| 13 | + |
| 14 | +# uv sync reads pyproject.toml, creates .venv, installs all dependencies |
| 15 | +RUN uv sync --no-dev --no-editable --index-strategy unsafe-best-match |
| 16 | + |
| 17 | +# Optional: compile bytecode for faster startup |
| 18 | +RUN uv run python -m compileall -b -f src \ |
| 19 | + && find src -name "*.py" -type f -delete |
22 | 20 |
|
23 | 21 | FROM $BUILD_FROM |
24 | | -ENV iSPBTV_docker=True iSPBTV_data_dir=data TERM=xterm-256color COLORTERM=truecolor |
| 22 | +ARG TEMPIO_VERSION BUILD_ARCH |
| 23 | + |
| 24 | +RUN curl -sSLf -o /usr/bin/tempio \ |
| 25 | + "https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}" |
| 26 | + |
| 27 | +ENV iSPBTV_docker=True \ |
| 28 | + iSPBTV_data_dir=data \ |
| 29 | + TERM=xterm-256color \ |
| 30 | + COLORTERM=truecolor \ |
| 31 | + PATH="/app/.venv/bin:$PATH" |
| 32 | + |
25 | 33 | WORKDIR /app |
26 | | -COPY --from=compiler /usr/bin/tempio /usr/bin/tempio |
27 | | -COPY --from=compiler /app . |
28 | | -COPY --from=compiler /usr/local/lib/python*/site-packages /usr/local/lib/python3.13/site-packages/ |
| 34 | +COPY --from=builder /app/src ./ |
| 35 | +COPY --from=builder /app/.venv ./.venv |
29 | 36 | COPY rootfs/ / |
30 | 37 |
|
31 | | -# Healthcheck to verify the service is running |
32 | 38 | HEALTHCHECK --interval=60s --timeout=10s --start-period=60s --retries=3 \ |
33 | | - CMD pgrep -f "python3.*main.pyc" > /dev/null || exit 1 |
| 39 | + CMD pgrep -f "python3.*main.pyc" > /dev/null || exit 1 |
0 commit comments