Skip to content

Commit 703e8e8

Browse files
committed
Add Dockerfile
1 parent 9c4fcdc commit 703e8e8

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed

Dockerfile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Automatically generated by hassfest.
2+
#
3+
# To update, run python3 -m script.hassfest -p docker
4+
ARG BUILD_FROM
5+
FROM ${BUILD_FROM}
6+
7+
# Synchronize with homeassistant/core.py:async_stop
8+
ENV \
9+
S6_SERVICES_GRACETIME=240000 \
10+
UV_SYSTEM_PYTHON=true \
11+
UV_NO_CACHE=true
12+
13+
ARG QEMU_CPU
14+
15+
# Home Assistant S6-Overlay
16+
COPY rootfs /
17+
18+
# Needs to be redefined inside the FROM statement to be set for RUN commands
19+
ARG BUILD_ARCH
20+
# Get go2rtc binary
21+
RUN \
22+
case "${BUILD_ARCH}" in \
23+
"aarch64") go2rtc_suffix='arm64' ;; \
24+
"armhf") go2rtc_suffix='armv6' ;; \
25+
"armv7") go2rtc_suffix='arm' ;; \
26+
*) go2rtc_suffix=${BUILD_ARCH} ;; \
27+
esac \
28+
&& curl -L https://github.com/AlexxIT/go2rtc/releases/download/v1.9.9/go2rtc_linux_${go2rtc_suffix} --output /bin/go2rtc \
29+
&& chmod +x /bin/go2rtc \
30+
# Verify go2rtc can be executed
31+
&& go2rtc --version
32+
33+
# Install uv
34+
RUN pip3 install uv==0.7.1
35+
36+
WORKDIR /usr/src
37+
38+
## Setup Home Assistant Core dependencies
39+
COPY requirements.txt homeassistant/
40+
COPY homeassistant/package_constraints.txt homeassistant/homeassistant/
41+
RUN \
42+
uv pip install \
43+
--no-build \
44+
-r homeassistant/requirements.txt
45+
46+
COPY requirements_all.txt home_assistant_frontend-* home_assistant_intents-* homeassistant/
47+
RUN \
48+
if ls homeassistant/home_assistant_*.whl 1> /dev/null 2>&1; then \
49+
uv pip install homeassistant/home_assistant_*.whl; \
50+
fi \
51+
&& uv pip install \
52+
--no-build \
53+
-r homeassistant/requirements_all.txt
54+
55+
## Setup Home Assistant Core
56+
COPY . homeassistant/
57+
RUN \
58+
uv pip install \
59+
-e ./homeassistant \
60+
&& python3 -m compileall \
61+
homeassistant/homeassistant
62+
63+
WORKDIR /config

Dockerfile.dev

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
FROM mcr.microsoft.com/vscode/devcontainers/base:debian
2+
3+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
4+
5+
RUN \
6+
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
7+
&& apt-get update \
8+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
9+
# Additional library needed by some tests and accordingly by VScode Tests Discovery
10+
bluez \
11+
ffmpeg \
12+
libudev-dev \
13+
libavformat-dev \
14+
libavcodec-dev \
15+
libavdevice-dev \
16+
libavutil-dev \
17+
libgammu-dev \
18+
libswscale-dev \
19+
libswresample-dev \
20+
libavfilter-dev \
21+
libpcap-dev \
22+
libturbojpeg0 \
23+
libyaml-dev \
24+
libxml2 \
25+
git \
26+
cmake \
27+
autoconf \
28+
&& apt-get clean \
29+
&& rm -rf /var/lib/apt/lists/*
30+
31+
# Add go2rtc binary
32+
COPY --from=ghcr.io/alexxit/go2rtc:latest /usr/local/bin/go2rtc /bin/go2rtc
33+
34+
WORKDIR /usr/src
35+
36+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
37+
38+
RUN uv python install 3.13.2
39+
40+
USER vscode
41+
ENV VIRTUAL_ENV="/home/vscode/.local/ha-venv"
42+
RUN uv venv $VIRTUAL_ENV
43+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
44+
45+
WORKDIR /tmp
46+
47+
# Setup hass-release
48+
RUN git clone --depth 1 https://github.com/home-assistant/hass-release ~/hass-release \
49+
&& uv pip install -e ~/hass-release/
50+
51+
# 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
57+
58+
WORKDIR /workspaces
59+
60+
# Set the default shell to bash instead of sh
61+
ENV SHELL=/bin/bash

0 commit comments

Comments
 (0)