Skip to content

Commit 2bb51e1

Browse files
authored
Reduce Devcontainer docker layers (home-assistant#157412)
1 parent d2248d2 commit 2bb51e1

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

Dockerfile.dev

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,22 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
3535

3636
USER vscode
3737

38-
COPY .python-version ./
39-
RUN uv python install
40-
4138
ENV VIRTUAL_ENV="/home/vscode/.local/ha-venv"
42-
RUN uv venv $VIRTUAL_ENV
39+
RUN --mount=type=bind,source=.python-version,target=.python-version \
40+
uv python install \
41+
&& uv venv $VIRTUAL_ENV
4342
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
4443

45-
WORKDIR /tmp
46-
4744
# Setup hass-release
4845
RUN git clone --depth 1 https://github.com/home-assistant/hass-release ~/hass-release \
4946
&& uv pip install -e ~/hass-release/
5047

5148
# Install Python dependencies from requirements
52-
COPY requirements.txt ./
53-
COPY homeassistant/package_constraints.txt homeassistant/package_constraints.txt
54-
RUN uv pip install -r requirements.txt
55-
COPY requirements_test.txt requirements_test_pre_commit.txt ./
56-
RUN uv pip install -r requirements_test.txt
49+
RUN --mount=type=bind,source=requirements.txt,target=requirements.txt \
50+
--mount=type=bind,source=homeassistant/package_constraints.txt,target=homeassistant/package_constraints.txt \
51+
--mount=type=bind,source=requirements_test.txt,target=requirements_test.txt \
52+
--mount=type=bind,source=requirements_test_pre_commit.txt,target=requirements_test_pre_commit.txt \
53+
uv pip install -r requirements.txt -r requirements_test.txt
5754

5855
WORKDIR /workspaces
5956

0 commit comments

Comments
 (0)