upgrade dockerfile
Some checks failed
Build, Push and Redeploy Docker Image / build-and-push (push) Failing after 3m45s
Some checks failed
Build, Push and Redeploy Docker Image / build-and-push (push) Failing after 3m45s
This commit is contained in:
40
Dockerfile
40
Dockerfile
@@ -16,15 +16,39 @@ RUN apt-get update && \
|
|||||||
cmake \
|
cmake \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Обновление pip и установка setuptools/wheel
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Кэшируем установку зависимостей Python
|
||||||
|
COPY requirements.txt .
|
||||||
RUN pip install --upgrade pip && \
|
RUN pip install --upgrade pip && \
|
||||||
pip install setuptools wheel
|
pip install setuptools wheel \
|
||||||
|
pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Проверка версии Python и pip
|
# Сборка RKLLM runtime
|
||||||
RUN python --version && pip --version
|
RUN git clone --depth 1 https://git.home/drholy/ezrknn-llm /tmp/rkllm-build && \
|
||||||
|
cp -r /tmp/rkllm-build/rkllm-runtime/runtime/Linux/librkllm_api/aarch64/* /usr/lib && \
|
||||||
|
cp -r /tmp/rkllm-build/rkllm-runtime/runtime/Linux/librkllm_api/include/* /usr/local/include && \
|
||||||
|
cd /tmp/rkllm-build/rkllm-runtime/examples/rkllm_api_demo && \
|
||||||
|
bash build-linux.sh && \
|
||||||
|
cp ./build/build_linux_aarch64_Release/llm_demo /usr/bin/rkllm && \
|
||||||
|
# Очистка временных файлов сборки
|
||||||
|
ldconfig && \
|
||||||
|
rm -rf /tmp/rkllm-build && \
|
||||||
|
apt-get purge -y git cmake build-essential libssl-dev && \
|
||||||
|
apt-get autoremove -y && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
# Копируем приложение (исключая кэш и модели)
|
||||||
|
COPY . .
|
||||||
|
|
||||||
# Очистка кэша
|
# Исключаем модели из образа — монтируем как volume при запуске
|
||||||
RUN apt-get clean && \
|
RUN rm -rf /app/models/* 2>/dev/null || true && \
|
||||||
rm -rf /tmp/* /var/tmp/*
|
find /app -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true && \
|
||||||
|
chmod +x /app/entrypoint.sh
|
||||||
|
|
||||||
|
# Порт Gradio по умолчанию
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||||
@@ -1,34 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
message_print() {
|
set -e # Автоматический выход при ошибке
|
||||||
echo
|
|
||||||
echo "#########################################"
|
|
||||||
echo $1
|
|
||||||
echo "#########################################"
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
|
|
||||||
cd /
|
echo
|
||||||
|
echo "#########################################"
|
||||||
|
echo "Starting RKLLM Gradio Server"
|
||||||
|
echo "#########################################"
|
||||||
|
echo
|
||||||
|
|
||||||
message_print "Changing to repository..."
|
# Проверка наличия моделей (монтируются через volume)
|
||||||
git clone https://git.home/drholy/ezrknn-llm
|
if [ ! -d "/app/models" ] || [ -z "$(ls -A /app/models 2>/dev/null)" ]; then
|
||||||
cd ezrknn-llm/
|
echo "⚠️ WARNING: Models directory is empty!"
|
||||||
cp ./rkllm-runtime/runtime/Linux/librkllm_api/aarch64/* /usr/lib
|
echo " Mount models volume: -v ./models:/app/models"
|
||||||
cp ./rkllm-runtime/runtime/Linux/librkllm_api/include/* /usr/local/include
|
sleep 5
|
||||||
|
fi
|
||||||
|
|
||||||
message_print "Compiling LLM runtime for Linux..."
|
# Запуск сервера
|
||||||
cd ./rkllm-runtime/examples/rkllm_api_demo/
|
exec python rkllm_server_gradio.py
|
||||||
bash build-linux.sh
|
|
||||||
|
|
||||||
message_print "Moving rkllm to /usr/bin..."
|
|
||||||
cp ./build/build_linux_aarch64_Release/llm_demo /usr/bin/rkllm
|
|
||||||
echo "* soft nofile 16384" >> /etc/security/limits.conf
|
|
||||||
echo "* hard nofile 1048576" >> /etc/security/limits.conf
|
|
||||||
|
|
||||||
message_print "Increasing file limit for all users (needed for LLMs to run)..."
|
|
||||||
echo "root soft nofile 16384" >> /etc/security/limits.conf
|
|
||||||
echo "root hard nofile 1048576" >> /etc/security/limits.conf
|
|
||||||
message_print "Done installing ezrknn-llm!"
|
|
||||||
|
|
||||||
message_print "Start Gradio server"
|
|
||||||
cd /app
|
|
||||||
python rkllm_server_gradio.py
|
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
services:
|
services:
|
||||||
rkllm:
|
rkllm:
|
||||||
build:
|
build: .
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
platform: linux/arm64/v8
|
platform: linux/arm64/v8
|
||||||
container_name: rkllm
|
container_name: rkllm
|
||||||
restart: always
|
restart: always
|
||||||
privileged: true
|
privileged: true
|
||||||
volumes:
|
volumes:
|
||||||
- ./app:/app
|
- ./models:/app/models:ro
|
||||||
- ./ezrknn-llm:/ezrknn-llm
|
ulimits:
|
||||||
entrypoint: ./app/entrypoint.sh
|
nofile:
|
||||||
|
soft: 16384
|
||||||
|
hard: 1048576
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
Reference in New Issue
Block a user