Skip to content

Commit b04b314

Browse files
authored
Extend Docker build caching opportunities (home-assistant#60661)
1 parent 9528679 commit b04b314

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

Dockerfile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,21 @@ ENV \
77

88
WORKDIR /usr/src
99

10-
## Setup Home Assistant
10+
## Setup Home Assistant Core dependencies
11+
COPY requirements.txt homeassistant/
12+
COPY homeassistant/package_constraints.txt homeassistant/homeassistant/
13+
RUN \
14+
pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \
15+
-r homeassistant/requirements.txt
16+
COPY requirements_all.txt homeassistant/
17+
RUN \
18+
pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \
19+
-r homeassistant/requirements_all.txt
20+
21+
## Setup Home Assistant Core
1122
COPY . homeassistant/
1223
RUN \
1324
pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \
14-
-r homeassistant/requirements_all.txt \
15-
&& pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \
1625
-e ./homeassistant \
1726
&& python3 -m compileall homeassistant/homeassistant
1827

Dockerfile.dev

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ RUN git clone --depth 1 https://github.com/home-assistant/hass-release \
3030
WORKDIR /workspaces
3131

3232
# Install Python dependencies from requirements
33-
COPY requirements.txt requirements_test.txt requirements_test_pre_commit.txt ./
33+
COPY requirements.txt ./
3434
COPY homeassistant/package_constraints.txt homeassistant/package_constraints.txt
35-
RUN pip3 install -r requirements.txt \
36-
&& pip3 install -r requirements_test.txt \
37-
&& rm -rf requirements.txt requirements_test.txt requirements_test_pre_commit.txt homeassistant/
35+
RUN pip3 install -r requirements.txt
36+
COPY requirements_test.txt requirements_test_pre_commit.txt ./
37+
RUN pip3 install -r requirements_test.txt
38+
RUN rm -rf requirements.txt requirements_test.txt requirements_test_pre_commit.txt homeassistant/
3839

3940
# Set the default shell to bash instead of sh
4041
ENV SHELL /bin/bash

0 commit comments

Comments
 (0)