AGI / Dockerfile
Dmitry Beresnev
fix dockerfile
09e70ff
raw
history blame
1.51 kB
FROM debian:bookworm-slim AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
build-essential \
cmake \
ca-certificates \
libcurl4-openssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Clone and build llama.cpp
WORKDIR /build
RUN git clone https://github.com/ggerganov/llama.cpp.git && \
cd llama.cpp && \
cmake -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DGGML_AVX2=OFF && \
cmake --build build --config Release --target llama-server -j$(nproc)
# Runtime stage
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libcurl4 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy llama-server binary from builder
COPY --from=builder /build/llama.cpp/build/bin/llama-server /usr/local/bin/llama-server
# Create non-root user
RUN useradd -m -u 1000 user && \
mkdir -p /home/user/.cache/llama.cpp && \
chown -R user:user /home/user
USER user
WORKDIR /home/user
# Set environment variables
ENV HOME=/home/user \
LLAMA_CACHE=/home/user/.cache/llama.cpp \
PATH=/home/user/.local/bin:$PATH
EXPOSE 7860
# Start llama-server with HuggingFace model
# Using TheBloke's DeepSeek Coder GGUF model
CMD ["llama-server", \
"-hf", "TheBloke/deepseek-coder-6.7B-instruct-GGUF:deepseek-coder-6.7b-instruct.Q4_K_M.gguf", \
"--host", "0.0.0.0", \
"--port", "7860", \
"-c", "2048", \
"--metrics"]