Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions docker/llama-swap.Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,37 @@ ARG BASE_TAG=server-cuda
FROM ghcr.io/ggml-org/llama.cpp:${BASE_TAG}

# has to be after the FROM
ARG LS_VER=89
ARG LS_VER=170

# Set default UID/GID arguments
ARG UID=10001
ARG GID=10001
ARG USER_HOME=/app

Comment on lines +7 to +11
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

PR description inconsistency with actual defaults.

The PR description states "defaults of 0 for backward compatibility," but the actual defaults are UID=10001, GID=10001. However, these non-zero defaults align with the maintainer's preference to hardcode uid:10001 and gid:10001, and the maintainer noted this should remain backward-compatible since llama-swap doesn't write to disk.

Consider updating the PR description to reflect the actual default values.

🤖 Prompt for AI Agents
In docker/llama-swap.Containerfile around lines 7 to 11 the ARG defaults are
UID=10001 and GID=10001 but the PR description incorrectly claims defaults of 0;
update the PR description to state the actual defaults are UID=10001 and
GID=10001, and optionally note the maintainer rationale that these non-zero
defaults are intentional and remain backward-compatible because llama-swap does
not write to disk.

# Add user/group
ENV HOME=$USER_HOME
RUN if [ $UID -ne 0 ]; then \
if [ $GID -ne 0 ]; then \
addgroup --system --gid $GID app; \
fi; \
adduser --system --no-create-home --uid $UID --gid $GID \
--home $USER_HOME app; \
fi

# Handle paths
RUN mkdir --parents $HOME /app
RUN chown --recursive $UID:$GID $HOME /app

# Switch user
USER $UID:$GID

WORKDIR /app
RUN \
curl -LO https://github.com/mostlygeek/llama-swap/releases/download/v"${LS_VER}"/llama-swap_"${LS_VER}"_linux_amd64.tar.gz && \
tar -zxf llama-swap_"${LS_VER}"_linux_amd64.tar.gz && \
rm llama-swap_"${LS_VER}"_linux_amd64.tar.gz

COPY config.example.yaml /app/config.yaml
COPY --chown=$UID:$GID config.example.yaml /app/config.yaml

HEALTHCHECK CMD curl -f http://localhost:8080/ || exit 1
ENTRYPOINT [ "/app/llama-swap", "-config", "/app/config.yaml" ]
ENTRYPOINT [ "/app/llama-swap", "-config", "/app/config.yaml" ]