mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-10 07:46:59 +00:00
Reorganize Docker build infrastructure for better maintainability
- Restructure from ollama37/ to docker/ with clear separation
- Separate builder and runtime images into dedicated directories
- Group environment scripts in builder/scripts/ subdirectory
- Add comprehensive root-level README.md (257 lines)
- Add .dockerignore files for optimized build contexts
- Enhance shell scripts with shebangs and documentation headers
- Update docker-compose.yml to build locally instead of pulling
- Add environment variables for GPU and host configuration
- Remove duplicate Dockerfile and confusing nested structure
New structure:
docker/
├── README.md (comprehensive documentation)
├── docker-compose.yml (local build support)
├── builder/ (build environment: CUDA 11.4 + GCC 10 + Go 1.24)
│ ├── Dockerfile
│ ├── README.md
│ ├── .dockerignore
│ └── scripts/ (organized environment setup)
└── runtime/ (production image)
├── Dockerfile
├── README.md
└── .dockerignore
This reorganization eliminates confusion, removes duplication, and
provides a professional, maintainable structure for Tesla K80 builds.
This commit is contained in:
35
docker/runtime/Dockerfile
Normal file
35
docker/runtime/Dockerfile
Normal file
@@ -0,0 +1,35 @@
|
||||
# ===== Stage 1: Build the source code =====
|
||||
FROM dogkeeper886/ollama37-builder AS builder
|
||||
|
||||
# Copy source code and build
|
||||
COPY . /usr/local/src/ollama37
|
||||
WORKDIR /usr/local/src/ollama37
|
||||
RUN CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++ cmake -B build \
|
||||
&& CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++ cmake --build build -j$(nproc) \
|
||||
&& go build -o ollama .
|
||||
|
||||
# ===== Stage 2: Runtime image =====
|
||||
FROM rockylinux/rockylinux:8
|
||||
|
||||
RUN dnf -y update
|
||||
|
||||
# Copy only the built binary and any needed assets from the builder stage
|
||||
COPY --from=builder /usr/local/src/ollama37 /usr/local/src/ollama37
|
||||
COPY --from=builder /usr/local/lib64 /usr/local/lib64
|
||||
COPY --from=builder /usr/local/cuda-11.4/lib64 /usr/local/cuda-11.4/lib64
|
||||
|
||||
# Create a symbolic link from the built binary to /usr/local/bin for easy access
|
||||
RUN ln -s /usr/local/src/ollama37/ollama /usr/local/bin/ollama
|
||||
|
||||
# Set environment variables
|
||||
ENV LD_LIBRARY_PATH="/usr/local/lib64:/usr/local/cuda-11.4/lib64"
|
||||
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
||||
ENV NVIDIA_VISIBLE_DEVICES=all
|
||||
ENV OLLAMA_HOST=0.0.0.0:11434
|
||||
|
||||
# Expose port
|
||||
EXPOSE 11434
|
||||
|
||||
# Set entrypoint and command
|
||||
ENTRYPOINT ["/usr/local/bin/ollama"]
|
||||
CMD ["serve"]
|
||||
Reference in New Issue
Block a user