91 lines
3.1 KiB
Docker
91 lines
3.1 KiB
Docker
# Utiliser l'image LocalAI officielle comme base
|
|
FROM localai/localai:latest-cpu
|
|
|
|
# Set shell
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
|
|
# Installer bashio et s6-overlay pour Home Assistant
|
|
ARG BASHIO_VERSION="v0.17.0"
|
|
ARG S6_OVERLAY_VERSION="3.2.1.0"
|
|
ARG BUILD_ARCH=amd64
|
|
|
|
RUN \
|
|
apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
ca-certificates \
|
|
curl \
|
|
jq \
|
|
xz-utils \
|
|
\
|
|
&& S6_ARCH="${BUILD_ARCH}" \
|
|
&& if [ "${BUILD_ARCH}" = "i386" ]; then S6_ARCH="i686"; \
|
|
elif [ "${BUILD_ARCH}" = "amd64" ]; then S6_ARCH="x86_64"; \
|
|
elif [ "${BUILD_ARCH}" = "armv7" ]; then S6_ARCH="arm"; fi \
|
|
\
|
|
&& curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" \
|
|
| tar -C / -Jxpf - \
|
|
&& curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz" \
|
|
| tar -C / -Jxpf - \
|
|
&& curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz" \
|
|
| tar -C / -Jxpf - \
|
|
&& curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz" \
|
|
| tar -C / -Jxpf - \
|
|
\
|
|
&& mkdir -p /etc/fix-attrs.d \
|
|
&& mkdir -p /etc/services.d \
|
|
\
|
|
&& curl -J -L -o /tmp/bashio.tar.gz \
|
|
"https://github.com/hassio-addons/bashio/archive/${BASHIO_VERSION}.tar.gz" \
|
|
&& 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 \
|
|
\
|
|
&& apt-get purge -y --auto-remove xz-utils \
|
|
&& apt-get clean \
|
|
&& rm -rf /tmp/* /var/lib/apt/lists/*
|
|
|
|
# Variables d'environnement pour s6
|
|
ENV \
|
|
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
|
|
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
|
|
S6_CMD_WAIT_FOR_SERVICES=1
|
|
|
|
# Variables d'environnement pour LocalAI
|
|
ENV LOCALAI_P2P="true"
|
|
ENV LOCALAI_FEDERATED="true"
|
|
ENV LOCALAI_P2P_LISTEN_PORT="9090"
|
|
ENV LOCALAI_ADDRESS="0.0.0.0:8080"
|
|
ENV LOCALAI_CORS="true"
|
|
ENV LOCALAI_CORS_ALLOW_ORIGINS="*"
|
|
|
|
# Créer le service s6 pour LocalAI
|
|
RUN mkdir -p /etc/services.d/localai
|
|
COPY run.sh /etc/services.d/localai/run
|
|
RUN chmod +x /etc/services.d/localai/run
|
|
|
|
# Entrypoint s6
|
|
ENTRYPOINT ["/init"]
|
|
|
|
# Build arguments
|
|
ARG BUILD_DATE
|
|
ARG BUILD_REF
|
|
ARG BUILD_VERSION
|
|
|
|
# Labels
|
|
LABEL \
|
|
io.hass.name="LocalAI P2P Worker" \
|
|
io.hass.description="LocalAI P2P federation worker node" \
|
|
io.hass.arch="${BUILD_ARCH}" \
|
|
io.hass.type="addon" \
|
|
io.hass.version=${BUILD_VERSION} \
|
|
maintainer="Alex <alex@example.com>" \
|
|
org.opencontainers.image.title="LocalAI P2P Worker" \
|
|
org.opencontainers.image.description="LocalAI P2P federation worker node" \
|
|
org.opencontainers.image.vendor="LocalAI Community" \
|
|
org.opencontainers.image.authors="Alex <alex@example.com>" \
|
|
org.opencontainers.image.licenses="MIT" \
|
|
org.opencontainers.image.created=${BUILD_DATE} \
|
|
org.opencontainers.image.revision=${BUILD_REF} \
|
|
org.opencontainers.image.version=${BUILD_VERSION}
|