Add lemonade
Tá an tiomantas seo le fáil i:
32
Services/lemonade/lemonade-ubuntu.Containerfile
Comhad gnáth
32
Services/lemonade/lemonade-ubuntu.Containerfile
Comhad gnáth
@@ -0,0 +1,32 @@
|
|||||||
|
# Lemonade Server ROCm Containerfile with lightweight runtime base
|
||||||
|
# Build: podman build -t lemonade:ubuntu-amd64 -f lemonade-ubuntu.Containerfile .
|
||||||
|
# Export: podman save -o /home/duckpage/lemonade-ubuntu-amd64.tar localhost/lemonade:ubuntu-amd64
|
||||||
|
|
||||||
|
# =========================
|
||||||
|
# Stage: Runtime (Lightweight ROCm runtime)
|
||||||
|
# =========================
|
||||||
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
|
USER root
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
# Install Lemonade SDK
|
||||||
|
RUN apt-get update && apt-get install -y nano unzip wget curl jq pciutils ffmpeg libatomic1 && \
|
||||||
|
apt-get clean && rm -rf /var/lib/apt/lists/* && \
|
||||||
|
update-pciids && \
|
||||||
|
VERSION=$(curl -s https://api.github.com/repos/lemonade-sdk/lemonade/releases/latest | jq -r .tag_name | sed 's/^v//') && \
|
||||||
|
wget -O /tmp/lemonade-server-minimal.deb \
|
||||||
|
https://github.com/lemonade-sdk/lemonade/releases/download/v${VERSION}/lemonade-server-minimal_${VERSION}_amd64.deb && \
|
||||||
|
dpkg -i /tmp/lemonade-server-minimal.deb || apt-get install -fy && \
|
||||||
|
rm /tmp/lemonade-server-minimal.deb
|
||||||
|
|
||||||
|
# Fix Proxy
|
||||||
|
COPY lemonade.fix-proxy.sh /usr/local/bin/fix-proxy.sh
|
||||||
|
RUN chmod +x /usr/local/bin/fix-proxy.sh
|
||||||
|
RUN /usr/local/bin/fix-proxy.sh
|
||||||
|
|
||||||
|
# Se nel tuo base usi un utente non-root (es. appuser), scommenta:
|
||||||
|
# USER appuser
|
||||||
|
|
||||||
|
ENTRYPOINT ["lemonade-server"]
|
||||||
|
CMD ["serve", "--port", "8000", "--host", "0.0.0.0", "--ctx-size", "131072", "--llamacpp", "vulkan"]
|
||||||
31
Services/lemonade/lemonade.container
Comhad gnáth
31
Services/lemonade/lemonade.container
Comhad gnáth
@@ -0,0 +1,31 @@
|
|||||||
|
[Container]
|
||||||
|
ContainerName=lemonade
|
||||||
|
Image=localhost/lemonade:ubuntu-amd64
|
||||||
|
#AutoUpdate=registry
|
||||||
|
Network=internal.network
|
||||||
|
PublishPort=8000:8000
|
||||||
|
|
||||||
|
# Production - Lemonade usa Hugging Face Hub per i modelli
|
||||||
|
Volume=/srv/containers/aitools/models/lemonade:/root/.cache/huggingface
|
||||||
|
|
||||||
|
# ROCm tuning
|
||||||
|
AddDevice=/dev/dri/renderD128
|
||||||
|
PodmanArgs=--group-add=keep-groups --ipc=host
|
||||||
|
SecurityLabelType=container_runtime_t
|
||||||
|
|
||||||
|
Environment=LEMONADE_LLAMACPP=vulkan
|
||||||
|
Environment=LEMONADE_HOST=0.0.0.0
|
||||||
|
Environment=LEMONADE_PORT=8000
|
||||||
|
Environment=LEMONADE_CTX_SIZE=131072
|
||||||
|
|
||||||
|
# HF
|
||||||
|
Environment=HF_HOME=/root/.cache/huggingface
|
||||||
|
Environment=HF_TOKEN=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
|
||||||
|
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Restart=on-failure
|
||||||
|
TimeoutStartSec=15m
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target default.target
|
||||||
43
Services/lemonade/lemonade.fix-proxy.sh
Comhad gnáth
43
Services/lemonade/lemonade.fix-proxy.sh
Comhad gnáth
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# fix-shared-js.sh — sostituisce la funzione getServerBaseUrl con window.location.origin
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
TARGET="/usr/local/share/lemonade-server/resources/static/js/shared.js"
|
||||||
|
TMP="$(mktemp)"
|
||||||
|
|
||||||
|
if [ ! -f "$TARGET" ]; then
|
||||||
|
echo "File non trovato: $TARGET"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copia il file in un temporaneo
|
||||||
|
cp "$TARGET" "$TMP"
|
||||||
|
|
||||||
|
# Rimuove il blocco della funzione esistente (apertura fino alla chiusura })
|
||||||
|
# e inserisce la nuova definizione. Usa awk per gestire blocchi multi-linea.
|
||||||
|
awk '
|
||||||
|
BEGIN { skip=0 }
|
||||||
|
/function[[:space:]]+getServerBaseUrl[[:space:]]*\(/ {
|
||||||
|
skip=1
|
||||||
|
next
|
||||||
|
}
|
||||||
|
skip==1 {
|
||||||
|
# cerca la chiusura della funzione (prima graffa singola a fine riga)
|
||||||
|
if ($0 ~ /^}/) {
|
||||||
|
skip=0
|
||||||
|
# inserisce la nuova funzione al posto di quella rimossa
|
||||||
|
print "function getServerBaseUrl() { return window.location.origin; }"
|
||||||
|
}
|
||||||
|
next
|
||||||
|
}
|
||||||
|
{ print }
|
||||||
|
' "$TMP" > "$TARGET"
|
||||||
|
|
||||||
|
# Verifica che la nuova funzione sia presente
|
||||||
|
if grep -q 'function getServerBaseUrl() { return window.location.origin; }' "$TARGET"; then
|
||||||
|
echo "Patch applicata con successo."
|
||||||
|
else
|
||||||
|
echo "Patch non riuscita: la nuova funzione non è stata trovata."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Tagairt in Eagrán Nua
Cuir bac ar úsáideoir