Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions claude-terminal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@ ARG BUILD_FROM
FROM ${BUILD_FROM}

# Install system packages and development tools
RUN apk add --no-cache \
RUN apt-get update && apt-get install -y --no-install-recommends \
bash \
curl \
nano \
nodejs \
npm \
python3 \
py3-pip \
py3-requests \
py3-aiohttp \
py3-yaml \
py3-beautifulsoup4 \
python3-pip \
python3-requests \
python3-aiohttp \
python3-yaml \
python3-bs4 \
git \
vim \
wget \
jq \
tree \
tmux \
yq
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --break-system-packages yq

# Install Claude Code CLI using native installer
# The installer places the binary in ~/.local/bin
Expand Down
6 changes: 3 additions & 3 deletions claude-terminal/build.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build_from:
aarch64: ghcr.io/home-assistant/aarch64-base:3.19
amd64: ghcr.io/home-assistant/amd64-base:3.19
armv7: ghcr.io/home-assistant/armv7-base:3.19
aarch64: ghcr.io/home-assistant/aarch64-base-debian:bookworm
amd64: ghcr.io/home-assistant/amd64-base-debian:bookworm
armv7: ghcr.io/home-assistant/armv7-base-debian:bookworm

labels:
org.opencontainers.image.title: "Home Assistant Add-on: Claude Terminal"
Expand Down
37 changes: 29 additions & 8 deletions claude-terminal/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,29 @@ migrate_legacy_auth_files() {
# Install required tools
install_tools() {
bashio::log.info "Installing additional tools..."
if ! apk add --no-cache ttyd jq curl tmux; then

# Install packages available in Debian repos
if ! apt-get update || ! apt-get install -y --no-install-recommends jq curl tmux wget; then
bashio::log.error "Failed to install required tools"
exit 1
fi
rm -rf /var/lib/apt/lists/*

# Install ttyd from GitHub releases (not in Debian repos)
if ! command -v ttyd &> /dev/null; then
bashio::log.info "Installing ttyd from GitHub releases..."
local arch
arch=$(uname -m)
case "$arch" in
x86_64) arch="x86_64" ;;
aarch64) arch="aarch64" ;;
armv7l) arch="armhf" ;;
*) bashio::log.error "Unsupported architecture: $arch"; exit 1 ;;
esac
wget -q "https://github.com/tsl0922/ttyd/releases/latest/download/ttyd.${arch}" -O /usr/local/bin/ttyd
chmod +x /usr/local/bin/ttyd
fi

bashio::log.info "Tools installed successfully"
}

Expand All @@ -126,13 +145,13 @@ install_persistent_packages() {
local apk_packages=""
local pip_packages=""

# Collect APK packages from Home Assistant config
# Collect APT packages from Home Assistant config
if bashio::config.has_value 'persistent_apk_packages'; then
local config_apk
config_apk=$(bashio::config 'persistent_apk_packages')
if [ -n "$config_apk" ] && [ "$config_apk" != "null" ]; then
apk_packages="$config_apk"
bashio::log.info "Found APK packages in config: $apk_packages"
bashio::log.info "Found APT packages in config: $apk_packages"
fi
fi

Expand Down Expand Up @@ -169,14 +188,16 @@ install_persistent_packages() {
apk_packages=$(echo "$apk_packages" | tr ' ' '\n' | sort -u | tr '\n' ' ' | xargs)
pip_packages=$(echo "$pip_packages" | tr ' ' '\n' | sort -u | tr '\n' ' ' | xargs)

# Install APK packages
# Install APT packages
if [ -n "$apk_packages" ]; then
bashio::log.info "Installing persistent APK packages: $apk_packages"
bashio::log.info "Installing persistent APT packages: $apk_packages"
# shellcheck disable=SC2086
if apk add --no-cache $apk_packages; then
bashio::log.info "APK packages installed successfully"
apt-get update
if apt-get install -y --no-install-recommends $apk_packages; then
bashio::log.info "APT packages installed successfully"
rm -rf /var/lib/apt/lists/*
else
bashio::log.warning "Some APK packages failed to install"
bashio::log.warning "Some APT packages failed to install"
fi
fi

Expand Down
Loading