taardis-demo / Dockerfile
CodeMasterCody3D's picture
Build pinned TAARDIS runtime on free CPU hosting
cf1e918 verified
Raw History Blame Contribute Delete
1.13 kB
FROM python:3.11-slim-bookworm AS build
RUN apt-get update && apt-get install -y --no-install-recommends build-essential cmake ninja-build git ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /src
RUN git init && git remote add origin https://github.com/CodeMasterCody3D/taardis-llama.cpp.git && git fetch --depth 1 origin 32030c5c910aba7c1e9ab56ce8aa66df729aa5b3 && git checkout --detach FETCH_HEAD
RUN cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DGGML_NATIVE=OFF -DLLAMA_CURL=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_SERVER=ON && cmake --build build --target llama-server -j 2
FROM python:3.11-slim-bookworm
RUN apt-get update && apt-get install -y --no-install-recommends libgomp1 libstdc++6 ca-certificates && rm -rf /var/lib/apt/lists/* && useradd -m -u 1000 user
COPY --from=build /src/build/bin/ /opt/llama/bin/
COPY --from=build /src/LICENSE /opt/llama/LICENSE
WORKDIR /app
COPY --chown=user:user app.py /app/app.py
ENV PYTHONUNBUFFERED=1 PORT=7860 TAARDIS_THREADS=2 LD_LIBRARY_PATH=/opt/llama/bin
USER user
EXPOSE 7860
CMD ["python", "/app/app.py"]