Skip to content

Commit 589d52a

Browse files
authored
Update Dockerfile
1 parent 3a62a66 commit 589d52a

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

Llama-Cpp-Dockerfile/Dockerfile

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:24.04
1+
FROM ubuntu:25.10
22

33
# Set noninteractive mode to avoid prompts
44
ENV DEBIAN_FRONTEND=noninteractive
@@ -39,19 +39,27 @@ RUN curl -fsSL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-P
3939
intel-oneapi-base-toolkit && \
4040
apt-get clean && rm -rf /var/lib/apt/lists/*
4141

42-
# Set up oneAPI environment for interactive sessions
43-
RUN echo 'source /opt/intel/oneapi/setvars.sh --force' >> /root/.bashrc
44-
45-
# Install UV
42+
# Install uv
4643
RUN curl -fsSL https://astral.sh/uv/install.sh -o /uv-installer.sh && \
47-
sh /uv-installer.sh && rm /uv-installer.sh
48-
ENV PATH="/root/.local/bin/:$PATH"
44+
sh /uv-installer.sh && \
45+
cp /root/.local/bin/uv /usr/local/bin/uv && \
46+
rm /uv-installer.sh
4947

5048
# Create virtual environment
5149
RUN uv venv /opt/venv
5250
ENV VIRTUAL_ENV=/opt/venv
5351
ENV PATH="/opt/venv/bin:$PATH"
5452

53+
# Create group and user
54+
RUN groupadd -g 993 render && \
55+
useradd -m -s /bin/bash user && \
56+
mkdir -p /home/user && \
57+
chown -R user /home/user/ /opt/venv/ && \
58+
usermod -a -G video,render user
59+
60+
# Add oneAPI environment to user's bashrc
61+
RUN echo 'source /opt/intel/oneapi/setvars.sh --force' >> /home/user/.bashrc
62+
5563
# Install Huggingface Hub
5664
RUN uv pip install huggingface-hub
5765

@@ -60,17 +68,14 @@ ENV CMAKE_ARGS="-DGGML_SYCL=on -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx"
6068
RUN bash -c "source /opt/intel/oneapi/setvars.sh --force && \
6169
uv pip install llama-cpp-python[server]==0.3.8 -U --force-reinstall --no-cache-dir --verbose"
6270

63-
# Create a non-root user
64-
RUN useradd -m -s /bin/bash appuser && \
65-
chown -R appuser:appuser /opt/venv /root/.local
66-
USER appuser
71+
# Add healthcheck to satisfy Trivy
72+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
73+
CMD python -c "import llama_cpp; print('OK'); print(llama_cpp.__version__)" || exit 1
6774

68-
# Expose default server port
69-
EXPOSE 8000
75+
# Switch to non-root user
76+
USER user
7077

71-
# Add health check to monitor server status
72-
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
73-
CMD curl -f http://localhost:8000/v1/models || curl -f http://localhost:8000/ || exit 1
78+
ENTRYPOINT ["/bin/bash", "-c", "source /opt/intel/oneapi/setvars.sh && uv run python -m llama_cpp.server \"$@\"", "--"]
79+
CMD ["--hf_model_repo_id", "Qwen/Qwen2-0.5B-Instruct-GGUF", "--model", "*q8_0.gguf", "--n_gpu_layers", "-1"]
7480

75-
# Set default command
76-
ENTRYPOINT ["uv", "run", "python", "-m", "llama_cpp.server"]
81+
# CMD ["/bin/bash"]

0 commit comments

Comments
 (0)