Skip to content

Commit 8ccec8e

Browse files
committed
Update devcontainer
1 parent b5f77f0 commit 8ccec8e

File tree

11 files changed

+17
-95
lines changed

11 files changed

+17
-95
lines changed

.devcontainer/Dockerfile

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
ARG BUILD_FROM BUILD_FROM_TAG
2-
FROM python:3.12-slim
1+
FROM homeassistant/home-assistant:dev
32

43
ENV DEVCONTAINER=true
54

65
COPY ./container /container
76
COPY ./install /install
87

9-
ARG OS_VARIANT CONTAINER_TYPE
108
RUN \
119
bash /install/init.sh \
1210
&& bash /install/container.sh \
13-
&& bash /install/integration.sh \
1411
&& bash /install/cleanup.sh
1512

1613
CMD ["bash"]

.devcontainer/container/helpers/common/homeassistant/start.sh .devcontainer/container/helpers/homeassistant/start.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
# shellcheck source=/dev/null
33

4-
source /opt/container/helpers/common/paths.sh
4+
source /opt/container/helpers/paths.sh
55
mkdir -p /config
66

77
if test -f "$(workspacePath)config/configuration.yaml"; then
@@ -22,12 +22,12 @@ fi
2222
if test -d "$(workspacePath)custom_components"; then
2323
echo "Symlink the custom component directory"
2424

25-
if test -d "$(workspacePath)custom_components"; then
25+
if test -d "/config/custom_components"; then
2626
rm -R /config/custom_components
2727
fi
2828

2929
ln -sf "$(workspacePath)custom_components/" /config/custom_components || echo "Could not copy the custom_component" exit 1
30-
elif test -f "__init__.py"; then
30+
elif test -f "__init__.py"; then
3131
echo "Having the component in the root is currently not supported"
3232
fi
3333

.devcontainer/container/helpers/integration/init.sh

-21
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
start: ## Start Home Assistant with the integration loaded
2-
@bash /opt/container/helpers/common/homeassistant/start.sh
2+
@bash /opt/container/helpers/homeassistant/start.sh
3+
4+
run:
5+
start
6+
7+
up:
8+
start
39

410
set-version: ## Set Home Assistant version
5-
@bash /opt/container/helpers/common/homeassistant/set-version.sh
11+
@bash /opt/container/helpers/homeassistant/set-version.sh
612

713
install: ## Install Home Assistant dev in the container
814
@python3 -m pip --disable-pip-version-check install --upgrade git+https://github.com/home-assistant/home-assistant.git@dev
915

1016
upgrade: ## Upgrade Home Assistant to latest dev in the container
1117
install
1218

13-
run:
14-
start
15-
1619
check-config: ## Check Home Assistant config
1720
@hass -c /config --script check_config
18-
19-
init: ## Initialize the dev env
20-
@bash /opt/container/helpers/integration/init.sh

.devcontainer/install/cleanup.sh

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
echo -e "\\033[0;34mRunning cleanup script 'cleanup.sh'\\033[0m"
44

5-
apt-get clean -y
65
rm -fr /var/lib/apt/lists/*
76
rm -fr /tmp/* /var/{cache,log}/*
87

.devcontainer/install/container.sh

+4-6
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,19 @@ echo -e "\\033[0;34mRunning install script 'container.sh'\\033[0m"
44

55
export DEBIAN_FRONTEND=noninteractive
66

7-
apt-get update
8-
apt-get install -y --no-install-recommends \
9-
make
7+
apk add --no-cache \
8+
make \
9+
git
1010

1111
mkdir -p /opt/container/makefiles
1212
mkdir -p /opt/container/helpers
13-
touch /opt/container/makefiles/dummy.mk
1413

1514
cp /container/container.mk /opt/container/container.mk
16-
cp -r /container/helpers/common /opt/container/helpers/common
15+
cp -r /container/helpers /opt/container/helpers
1716

1817
cp /container/container /usr/bin/container
1918
chmod +x /usr/bin/container
2019

2120
cp /container/makefiles/integration.mk /opt/container/makefiles/integration.mk
22-
cp -r /container/helpers/integration /opt/container/helpers/integration
2321

2422
container help

.devcontainer/install/integration.sh

-47
This file was deleted.

scripts/devcontainer

+1-5
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ if ! ${docker} ps -a | grep -wq ${container} && [[ "${cmd}" != "down" ]]; then
8484
${docker} create -it --name "${container}" -p "${port}" -v "${volume}" "${image}"
8585

8686
docker_start
87-
88-
log.info "Initialize container..."
89-
${docker} exec -it -w "${workdir}" "${container}" container install
90-
bootstrap "install"
9187
fi
9288

9389
if [[ "${cmd}" == "menu" ]]; then
@@ -143,7 +139,7 @@ case "${cmd}" in
143139
docker_start
144140
fi
145141
log.info "Send command '${cmd}' to container..."
146-
if [[ "${cmd}" == "start" ]]; then
142+
if [[ "${cmd}" == "start" || "${cmd}" == "up" || "${cmd}" == "run" ]]; then
147143
log.info "Note: After Home Assistant initialization you can access to system on http://localhost:9123/"
148144
fi
149145
${docker} exec -it -w "${workdir}" "${container}" container "${cmd}"

0 commit comments

Comments
 (0)