refactor: split ai/ into hermes/ and ollama/ directories
- Rename ai/ to hermes/ (Hermes agent service) - Move ai/ollama/ to ollama/ (top-level, Ollama ROCm/gfx906 service) - Add ollama/compose.yml for standalone ollama deployment - Update hermes/compose.yml: remove ollama service (now in ollama/) - Update Makefile SERVICES list: ai -> hermes, add ollama - Bump ollama version from v0.13.5 to v0.23.2
This commit is contained in:
61
ollama/Dockerfile
Normal file
61
ollama/Dockerfile
Normal file
@@ -0,0 +1,61 @@
|
||||
# ollama/Dockerfile
|
||||
#
|
||||
# Custom ollama image with ROCm + gfx906 (MI50) support.
|
||||
# The default ollama/rocm image ships ROCm 7.2 which drops gfx906 support.
|
||||
# This builds ollama and its llama.cpp runner from source, targeting gfx906.
|
||||
#
|
||||
# Build:
|
||||
# docker build -t ollama/ollama:rocm-gfx906 ./ollama
|
||||
|
||||
FROM rocm/dev-ubuntu-22.04:6.1.2-complete AS builder
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
git golang-go cmake build-essential pkg-config \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ARG OLLAMA_VERSION=v0.23.2
|
||||
RUN git clone --depth 1 --branch ${OLLAMA_VERSION} https://github.com/ollama/ollama.git /build
|
||||
WORKDIR /build
|
||||
|
||||
ENV HIP_PATH=/opt/rocm
|
||||
ENV ROCM_PATH=/opt/rocm
|
||||
ENV PATH=/opt/rocm/bin:/opt/rocm/hip/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
RUN cd llama.cpp && \
|
||||
mkdir -p build && cd build && \
|
||||
cmake .. \
|
||||
-DLLAMA_HIPBLAS=ON \
|
||||
-DCMAKE_C_COMPILER=clang \
|
||||
-DCMAKE_CXX_COMPILER=clang++ \
|
||||
-DAMDGPU_TARGETS=gfx906 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLAMA_NATIVE=OFF \
|
||||
-DLLAMA_BUILD_TESTS=OFF \
|
||||
-DLLAMA_BUILD_EXAMPLES=OFF \
|
||||
-DLLAMA_BUILD_SERVER=OFF && \
|
||||
cmake --build . --config Release -j$(nproc) && \
|
||||
cmake --install . --prefix /build/dist
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
RUN go build -trimpath -o dist/ollama .
|
||||
|
||||
FROM ubuntu:22.04
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
ca-certificates curl libstdc++6 libgomp1 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=builder /opt/rocm/lib/ /opt/rocm/lib/
|
||||
COPY --from=builder /opt/rocm/share/ /opt/rocm/share/
|
||||
COPY --from=builder /build/dist/ollama /usr/bin/ollama
|
||||
COPY --from=builder /build/dist/lib/ /usr/lib/ollama/
|
||||
|
||||
RUN ldconfig
|
||||
|
||||
ENV LD_LIBRARY_PATH=/opt/rocm/lib:/usr/lib/ollama
|
||||
ENV HSA_OVERRIDE_GFX_VERSION=9.0.6
|
||||
ENV HCC_AMDGPU_TARGET=gfx906
|
||||
ENV HSA_ENABLE_SDMA=0
|
||||
|
||||
EXPOSE 11434
|
||||
ENTRYPOINT ["/bin/ollama"]
|
||||
CMD ["serve"]
|
||||
Reference in New Issue
Block a user