Skip to content
This repository has been archived by the owner on Aug 30, 2020. It is now read-only.

Commit

Permalink
Clean up docker file and docker run.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Apr 19, 2020
1 parent 465d1e6 commit 3e9c4be
Show file tree
Hide file tree
Showing 32 changed files with 14 additions and 956 deletions.
20 changes: 14 additions & 6 deletions docker/run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env bash
this_dir="$( cd "$( dirname "$0" )" && pwd )"

# Try to detemine where Rhasspy is located
if [[ -z "${RHASSPY_APP}" ]]; then
Expand All @@ -16,12 +15,21 @@ if [[ -f "${CONFIG_PATH}" ]]; then
# Hass.IO configuration
profile_name="$(jq --raw-output '.profile_name' "${CONFIG_PATH}")"
profile_dir="$(jq --raw-output '.profile_dir' "${CONFIG_PATH}")"
RHASSPY_ARGS="--profile ${profile_name} --user-profiles ${profile_dir}"
RHASSPY_ARGS=('--profile' "${profile_name}" '--user-profiles' "${profile_dir}")

asoundrc="$(jq --raw-output '.asoundrc' ${CONFIG_PATH})"
# Copy user-defined asoundrc to root
asoundrc="$(jq --raw-output '.asoundrc' "${CONFIG_PATH}")"
if [[ ! -z "${asoundrc}" ]]; then
echo "${asoundrc}" > /root/.asoundrc
fi

# Add SSL settings
ssl="$(jq --raw-output '.ssl' "${CONFIG_PATH}")"
if [[ "${ssl}" == 'true' ]]; then
certfile="$(jq --raw-output '.certfile' "${CONFIG_PATH}")"
keyfile="$(jq --raw-output '.keyfile' "${CONFIG_PATH}")"
RHASSPY_ARGS+=('--ssl' "${certfile}" "${keyfile}")
fi
fi

RHASSPY_VENV="${RHASSPY_APP}/.venv"
Expand All @@ -32,10 +40,10 @@ if [[ -d "${RHASSPY_VENV}" ]]; then
export LD_LIBRARY_PATH="${RHASSPY_VENV}/lib:${LD_LIBRARY_PATH}"
fi

cd "${RHASSPY_APP}"
cd "${RHASSPY_APP}" || exit 1

if [[ -z "${RHASSPY_ARGS}" ]]; then
if [[ -z "${RHASSPY_ARGS[*]}" ]]; then
python3 app.py "$@"
else
python3 app.py ${RHASSPY_ARGS} "$@"
python3 app.py "${RHASSPY_ARGS[@]}" "$@"
fi
52 changes: 0 additions & 52 deletions docker/templates/Dockerfile.template

This file was deleted.

1 change: 0 additions & 1 deletion docker/templates/all_profiles/profiles.txt

This file was deleted.

1 change: 0 additions & 1 deletion docker/templates/alsa/pulseaudio.txt

This file was deleted.

Empty file.
207 changes: 0 additions & 207 deletions docker/templates/dockerfiles/Dockerfile.from-source.alsa.all

This file was deleted.

Loading

0 comments on commit 3e9c4be

Please sign in to comment.