mirror of
https://github.com/mtan93/homeassistant-addons.git
synced 2026-03-08 05:21:51 +00:00
39 lines
1.7 KiB
Docker
39 lines
1.7 KiB
Docker
ARG BUILD_FROM
|
|
FROM $BUILD_FROM
|
|
|
|
# add bashio (thx https://github.com/hassio-addons/addon-debian-base/blob/main/base/Dockerfile#L47)
|
|
ADD https://github.com/hassio-addons/bashio/archive/v0.14.3.tar.gz /tmp/bashio.tar.gz
|
|
RUN apt-get update && apt-get install -y curl jq && mkdir /tmp/bashio \
|
|
&& tar zxvf \
|
|
/tmp/bashio.tar.gz \
|
|
--strip 1 -C /tmp/bashio \
|
|
\
|
|
&& mv /tmp/bashio/lib /usr/lib/bashio \
|
|
&& ln -s /usr/lib/bashio/bashio /usr/bin/bashio
|
|
|
|
# add the options.json to environment variable magic
|
|
COPY export-env-from-config.sh /export-env-from-config.sh
|
|
|
|
|
|
RUN find /etc/s6-overlay/s6-rc.d/ -name script | xargs sed -i '1 a\source /export-env-from-config.sh'
|
|
RUN find /etc/s6-overlay/s6-rc.d/ -name run | xargs sed -i '1 a\source /export-env-from-config.sh'
|
|
|
|
# Fix memory issue for e.g. HA OS 10 - see https://github.com/MaxWinterstein/homeassistant-addons/issues/149
|
|
RUN sed -i '5 a\ ulimit -n 1048576' /etc/s6-overlay/s6-rc.d/http/run
|
|
|
|
ENV TZ=UTC
|
|
|
|
# Add the nice banner
|
|
|
|
ADD https://raw.githubusercontent.com/hassio-addons/addon-debian-base/v5.1.0/base/rootfs/etc/cont-init.d/00-banner.sh /etc/s6-overlay/s6-rc.d/banner/
|
|
RUN mkdir -p /etc/s6-overlay/s6-rc.d/banner && \
|
|
echo "oneshot" > /etc/s6-overlay/s6-rc.d/banner/type && \
|
|
echo "/etc/s6-overlay/s6-rc.d/banner/script" > /etc/s6-overlay/s6-rc.d/banner/up && \
|
|
touch /etc/s6-overlay/s6-rc.d/user/contents.d/banner && \
|
|
mv /etc/s6-overlay/s6-rc.d/banner/00-banner.sh /etc/s6-overlay/s6-rc.d/banner/script && \
|
|
chmod +x /etc/s6-overlay/s6-rc.d/banner/script && \
|
|
sed -i '1 s/^.*$/#!\/command\/with-contenv bashio/' /etc/s6-overlay/s6-rc.d/banner/script
|
|
|
|
# enhance timeout, as sometimes the api calls are slow (rate limited?)
|
|
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=30000
|