Test
This commit is contained in:
63
Dockerfile
63
Dockerfile
@@ -1,20 +1,47 @@
|
|||||||
FROM ghcr.io/hassio-addons/debian-base:7.2.0
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
|
FROM ghcr.io/linuxserver/baseimage-ubuntu:noble
|
||||||
|
|
||||||
|
# set version label
|
||||||
|
ARG BUILD_DATE
|
||||||
|
ARG VERSION
|
||||||
|
ARG FOLDINGATHOME_RELEASE
|
||||||
|
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
|
||||||
|
LABEL maintainer="aptalca"
|
||||||
|
|
||||||
|
#Add needed nvidia environment variables for container toolkit
|
||||||
|
ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility"
|
||||||
|
|
||||||
|
# global environment settings
|
||||||
|
ENV DEBIAN_FRONTEND="noninteractive"
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
echo "deb http://deb.debian.org/debian bullseye main" > /etc/apt/sources.list && \
|
echo "**** install runtime packages ****" && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y \
|
||||||
curl \
|
bzip2 \
|
||||||
ca-certificates \
|
intel-opencl-icd \
|
||||||
gnupg && \
|
libexpat1 && \
|
||||||
curl -sSL https://download.foldingathome.org/releases/public/fah-client/debian-10-64bit/release/fah-client_8.4.9_amd64.deb -o /fahclient.deb && \
|
ln -s libOpenCL.so.1 /usr/lib/x86_64-linux-gnu/libOpenCL.so && \
|
||||||
echo "Installing fahclient..." && \
|
echo "**** install foldingathome ****" && \
|
||||||
dpkg -i /fahclient.deb && \
|
download_url="https://download.foldingathome.org/releases/public/fah-client/"$(curl -s https://download.foldingathome.org/releases/public/fah-client/meta.json | jq -r '.[] | select((.package | contains("debian")) and (.package | contains("release"))) | .package' | grep -v "arm64" | grep "tar.bz2") && \
|
||||||
apt-get install -f -y && \
|
curl -o \
|
||||||
echo "Verifying installation..." && \
|
/tmp/fah.tar.bz2 -L \
|
||||||
ls -l /usr/bin/fahclient || echo "fahclient not found" && \
|
${download_url} && \
|
||||||
rm /fahclient.deb && \
|
tar xf /tmp/fah.tar.bz2 -C /app --strip-components=1 && \
|
||||||
apt-get clean && \
|
printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
echo "**** cleanup ****" && \
|
||||||
COPY rootfs /
|
apt-get clean && \
|
||||||
|
rm -rf \
|
||||||
|
/tmp/* \
|
||||||
|
/var/lib/apt/lists/* \
|
||||||
|
/var/tmp/* \
|
||||||
|
/var/log/*
|
||||||
|
|
||||||
|
# add local files
|
||||||
|
COPY root/ /
|
||||||
|
|
||||||
|
# ports and volumes
|
||||||
EXPOSE 7396
|
EXPOSE 7396
|
||||||
CMD ["/usr/bin/fahclient", "--config", "/config/config.xml", "${CLI_ARGS}"]
|
|
||||||
|
VOLUME /config
|
||||||
1
root/etc/OpenCL/vendors/nvidia.icd
vendored
Normal file
1
root/etc/OpenCL/vendors/nvidia.icd
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
libnvidia-opencl.so.1
|
||||||
6
root/etc/s6-overlay/s6-rc.d/init-foldingathome-config/run
Executable file
6
root/etc/s6-overlay/s6-rc.d/init-foldingathome-config/run
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
# permissions on config root and folders
|
||||||
|
lsiown -R abc:abc \
|
||||||
|
/config
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
oneshot
|
||||||
1
root/etc/s6-overlay/s6-rc.d/init-foldingathome-config/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-foldingathome-config/up
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/etc/s6-overlay/s6-rc.d/init-foldingathome-config/run
|
||||||
36
root/etc/s6-overlay/s6-rc.d/init-foldingathome-video/run
Executable file
36
root/etc/s6-overlay/s6-rc.d/init-foldingathome-video/run
Executable file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
FILES=$(find /dev/dri /dev/dvb -type c -print 2>/dev/null)
|
||||||
|
|
||||||
|
for i in $FILES
|
||||||
|
do
|
||||||
|
VIDEO_GID=$(stat -c '%g' "${i}")
|
||||||
|
VIDEO_UID=$(stat -c '%u' "${i}")
|
||||||
|
# check if user matches device
|
||||||
|
if id -u abc | grep -qw "${VIDEO_UID}"; then
|
||||||
|
echo "**** permissions for ${i} are good ****"
|
||||||
|
else
|
||||||
|
# check if group matches and that device has group rw
|
||||||
|
if id -G abc | grep -qw "${VIDEO_GID}" && [ $(stat -c '%A' "${i}" | cut -b 5,6) = "rw" ]; then
|
||||||
|
echo "**** permissions for ${i} are good ****"
|
||||||
|
# check if device needs to be added to video group
|
||||||
|
elif ! id -G abc | grep -qw "${VIDEO_GID}"; then
|
||||||
|
# check if video group needs to be created
|
||||||
|
VIDEO_NAME=$(getent group "${VIDEO_GID}" | awk -F: '{print $1}')
|
||||||
|
if [ -z "${VIDEO_NAME}" ]; then
|
||||||
|
VIDEO_NAME="video$(head /dev/urandom | tr -dc 'a-z0-9' | head -c4)"
|
||||||
|
groupadd "${VIDEO_NAME}"
|
||||||
|
groupmod -g "${VIDEO_GID}" "${VIDEO_NAME}"
|
||||||
|
echo "**** creating video group ${VIDEO_NAME} with id ${VIDEO_GID} ****"
|
||||||
|
fi
|
||||||
|
echo "**** adding ${i} to video group ${VIDEO_NAME} with id ${VIDEO_GID} ****"
|
||||||
|
usermod -a -G "${VIDEO_NAME}" abc
|
||||||
|
fi
|
||||||
|
# check if device has group rw
|
||||||
|
if [ $(stat -c '%A' "${i}" | cut -b 5,6) != "rw" ]; then
|
||||||
|
echo -e "**** The device ${i} does not have group read/write permissions, attempting to fix inside the container. ****"
|
||||||
|
chmod g+rw "${i}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
oneshot
|
||||||
1
root/etc/s6-overlay/s6-rc.d/init-foldingathome-video/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-foldingathome-video/up
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/etc/s6-overlay/s6-rc.d/init-foldingathome-video/run
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
3
|
||||||
27
root/etc/s6-overlay/s6-rc.d/svc-foldingathome/run
Executable file
27
root/etc/s6-overlay/s6-rc.d/svc-foldingathome/run
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
if [[ -n "${ACCOUNT_TOKEN}" ]] && [[ -n "${MACHINE_NAME}" ]]; then
|
||||||
|
TOKEN_AND_NAME="--account-token ${ACCOUNT_TOKEN} --machine-name ${MACHINE_NAME}"
|
||||||
|
else
|
||||||
|
echo '
|
||||||
|
***************************************************************************
|
||||||
|
***************************************************************************
|
||||||
|
**** ****
|
||||||
|
**** ****
|
||||||
|
**** On first run, both the ACCOUNT_TOKEN and the MACHINE_NAME ****
|
||||||
|
**** env vars are required. Please set them and recreate the container ****
|
||||||
|
**** unless the instance was previously added to online account. ****
|
||||||
|
**** ****
|
||||||
|
**** ****
|
||||||
|
***************************************************************************
|
||||||
|
***************************************************************************
|
||||||
|
'
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
exec \
|
||||||
|
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 7396" \
|
||||||
|
cd /config s6-setuidgid abc /app/fah-client \
|
||||||
|
--http-addresses 0.0.0.0:7396 --allow 0/0 ${TOKEN_AND_NAME} \
|
||||||
|
${CLI_ARGS}
|
||||||
1
root/etc/s6-overlay/s6-rc.d/svc-foldingathome/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/svc-foldingathome/type
Normal file
@@ -0,0 +1 @@
|
|||||||
|
longrun
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
|
||||||
CONFIG_PATH=/config
|
|
||||||
mkdir -p "$CONFIG_PATH"
|
|
||||||
if [ ! -f "$CONFIG_PATH/config.xml" ]; then
|
|
||||||
cat > "$CONFIG_PATH/config.xml" << EOC
|
|
||||||
<config>
|
|
||||||
<user value="${USER:-Anonymous}"/>
|
|
||||||
<team value="${TEAM:-247478}"/>
|
|
||||||
<passkey value="${PASSKEY:-}"/>
|
|
||||||
<power value="${POWER:-medium}"/>
|
|
||||||
<web-enable value="true"/>
|
|
||||||
<http-addresses value="0.0.0.0:7396"/>
|
|
||||||
<account-token value="${ACCOUNT_TOKEN:-}"/>
|
|
||||||
<machine-id value="${MACHINE_NAME:-HomeAssistant}"/>
|
|
||||||
</config>
|
|
||||||
EOC
|
|
||||||
echo "Config created at $CONFIG_PATH/config.xml"
|
|
||||||
fi
|
|
||||||
if [ -n "$CLI_ARGS" ]; then
|
|
||||||
export CLI_ARGS
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user