Refactor to use LuaJIT and improve performance
Integrate LuaJIT as an optional runtime for better performance, with a fallback to standard Lua 5.4. Update Dockerfile to install LuaJIT and create a wrapper script for execution. Enhance network module with socket fallback support and update README to reflect these changes and configuration options.
This commit is contained in:
15
Dockerfile
15
Dockerfile
@@ -4,7 +4,7 @@ FROM alpine:3.20
|
||||
# Install minimal tooling
|
||||
RUN apk add --no-cache \
|
||||
--repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing wol \
|
||||
&& apk add --no-cache bash curl ca-certificates docker-cli lua5.4 lua5.4-socket openssh-client
|
||||
&& apk add --no-cache bash curl ca-certificates docker-cli lua5.4 lua5.4-socket luajit luajit-dev openssh-client netcat-openbsd
|
||||
|
||||
# Create the ssh directory
|
||||
RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh
|
||||
@@ -28,6 +28,17 @@ RUN ssh-keyscan -T 5 -H "$OLLAMA_HOST" >> /root/.ssh/known_hosts || true
|
||||
WORKDIR /app
|
||||
COPY scripts/* .
|
||||
|
||||
# Create a wrapper script to choose between lua5.4 and luajit
|
||||
RUN echo '#!/bin/sh' > /app/run-lua.sh && \
|
||||
echo 'if [ "$USE_LUAJIT" = "true" ]; then' >> /app/run-lua.sh && \
|
||||
echo ' echo "Using LuaJIT for better performance"' >> /app/run-lua.sh && \
|
||||
echo ' exec luajit /app/auto-boot-ollama-host.lua "$@"' >> /app/run-lua.sh && \
|
||||
echo 'else' >> /app/run-lua.sh && \
|
||||
echo ' echo "Using standard Lua 5.4"' >> /app/run-lua.sh && \
|
||||
echo ' exec lua5.4 /app/auto-boot-ollama-host.lua "$@"' >> /app/run-lua.sh && \
|
||||
echo 'fi' >> /app/run-lua.sh && \
|
||||
chmod +x /app/run-lua.sh
|
||||
|
||||
#COPY scripts/auto-boot-ollama-host.sh /usr/local/bin/auto-boot-ollama-host.sh
|
||||
#RUN chmod +x /usr/local/bin/auto-boot-ollama-host.sh
|
||||
|
||||
@@ -37,4 +48,4 @@ ENV CONTAINER_NAME=paperless-ai \
|
||||
OLLAMA_PORT=${OLLAMA_PORT} \
|
||||
SINCE=${SINCE:-0s}
|
||||
|
||||
ENTRYPOINT ["lua5.4", "/app/auto-boot-ollama-host.lua"]
|
||||
ENTRYPOINT ["/app/run-lua.sh"]
|
||||
Reference in New Issue
Block a user