Skip to content

Commit

Permalink
Merge pull request #108 from linuxserver/uv
Browse files Browse the repository at this point in the history
switch to uv instead of pip
  • Loading branch information
aptalca authored Oct 8, 2024
2 parents b36b2b4 + 19bb252 commit d02ff9e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA
LABEL maintainer="saarg, roxedus"

ENV \
S6_SERVICES_GRACETIME=240000
S6_SERVICES_GRACETIME=240000 \
UV_SYSTEM_PYTHON=true \
UV_EXTRA_INDEX_URL="https://wheels.home-assistant.io/musllinux-index/"

COPY root/etc/pip.conf /etc/

Expand Down Expand Up @@ -133,6 +135,7 @@ RUN \
HA_PIP_VERSION=$(cat /tmp/ha-docker-base/python/${HA_PY_MAJOR}/build.yaml \
| grep 'PIP_VERSION: ' \
| sed 's|.*PIP_VERSION: ||') && \
HA_UV_VERSION=$(curl -fsL "https://raw.githubusercontent.com/home-assistant/core/refs/tags/${HASS_RELEASE}/Dockerfile" | grep 'install uv==' | sed 's|RUN pip3 install uv==||') && \
echo "**** install jemalloc ****" && \
git clone --branch ${HA_JEMALLOC_VER} \
--depth 1 "https://github.com/jemalloc/jemalloc" \
Expand Down Expand Up @@ -211,18 +214,17 @@ RUN \
fi && \
echo "**** install homeassistant ****" && \
cd /tmp/core && \
pip3 install --only-binary=:all: \
pip3 install uv==${HA_UV_VERSION} && \
uv pip install --no-build \
-r https://raw.githubusercontent.com/home-assistant/docker/${HASS_BASE}/requirements.txt && \
pip3 install --only-binary=:all: \
uv pip install --no-build \
-r requirements.txt && \
PYCUPS_VER=$(grep "pycups" requirements_all.txt | sed 's|.*==||') && \
LD_PRELOAD="/usr/local/lib/libjemalloc.so.2" \
MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:20000,muzzy_decay_ms:20000" \
pip3 install --only-binary=:all: \
uv pip install --no-build \
-r requirements_all.txt \
isal \
pycups==${PYCUPS_VER} && \
pip3 install \
uv pip install \
homeassistant==${HASS_RELEASE} && \
for cleanfiles in *.pyc *.pyo; do \
find /usr/local/lib/python3.* -iname "${cleanfiles}" -exec rm -f '{}' + ; \
Expand Down
16 changes: 9 additions & 7 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA
LABEL maintainer="saarg, roxedus"

ENV \
S6_SERVICES_GRACETIME=240000
S6_SERVICES_GRACETIME=240000 \
UV_SYSTEM_PYTHON=true \
UV_EXTRA_INDEX_URL="https://wheels.home-assistant.io/musllinux-index/"

COPY root/etc/pip.conf /etc/

Expand Down Expand Up @@ -133,6 +135,7 @@ RUN \
HA_PIP_VERSION=$(cat /tmp/ha-docker-base/python/${HA_PY_MAJOR}/build.yaml \
| grep 'PIP_VERSION: ' \
| sed 's|.*PIP_VERSION: ||') && \
HA_UV_VERSION=$(curl -fsL "https://raw.githubusercontent.com/home-assistant/core/refs/tags/${HASS_RELEASE}/Dockerfile" | grep 'install uv==' | sed 's|RUN pip3 install uv==||') && \
echo "**** install jemalloc ****" && \
git clone --branch ${HA_JEMALLOC_VER} \
--depth 1 "https://github.com/jemalloc/jemalloc" \
Expand Down Expand Up @@ -211,18 +214,17 @@ RUN \
fi && \
echo "**** install homeassistant ****" && \
cd /tmp/core && \
pip3 install --only-binary=:all: \
pip3 install uv==${HA_UV_VERSION} && \
uv pip install --no-build \
-r https://raw.githubusercontent.com/home-assistant/docker/${HASS_BASE}/requirements.txt && \
pip3 install --only-binary=:all: \
uv pip install --no-build \
-r requirements.txt && \
PYCUPS_VER=$(grep "pycups" requirements_all.txt | sed 's|.*==||') && \
LD_PRELOAD="/usr/local/lib/libjemalloc.so.2" \
MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:20000,muzzy_decay_ms:20000" \
pip3 install --only-binary=:all: \
uv pip install --no-build \
-r requirements_all.txt \
isal \
pycups==${PYCUPS_VER} && \
pip3 install \
uv pip install \
homeassistant==${HASS_RELEASE} && \
for cleanfiles in *.pyc *.pyo; do \
find /usr/local/lib/python3.* -iname "${cleanfiles}" -exec rm -f '{}' + ; \
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64

## Versions

* **07.10.24:** - Switch to `uv` instead of `pip`.
* **03.07.24:** - Rebase to alpine 3.20.
* **05.03.24:** - Add mime.types to help with detection of certain media files.
* **13.02.24:** - Rebase to alpine 3.19, upgrade to python 3.12. Restructure python packages so all packages are internal (no more venv in /config). Use upstream project's wheels. Due to an upstream issue, on first start of the newly updated container, some custom integrations may be disabled in HA due to missing dependencies. A subsequent container restart should fix that and the integrations should be re-enabled.
Expand Down
1 change: 1 addition & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ app_setup_block: |
unraid_template_sync: false
# changelog
changelogs:
- {date: "07.10.24:", desc: "Switch to `uv` instead of `pip`."}
- {date: "03.07.24:", desc: "Rebase to alpine 3.20."}
- {date: "05.03.24:", desc: "Add mime.types to help with detection of certain media files."}
- {date: "13.02.24:", desc: "Rebase to alpine 3.19, upgrade to python 3.12. Restructure python packages so all packages are internal (no more venv in /config). Use upstream project's wheels. Due to an upstream issue, on first start of the newly updated container, some custom integrations may be disabled in HA due to missing dependencies. A subsequent container restart should fix that and the integrations should be re-enabled."}
Expand Down

0 comments on commit d02ff9e

Please sign in to comment.