File size: 721 Bytes
cc505fc
 
 
 
 
 
 
 
2d2dd6b
cc505fc
2d2dd6b
 
 
6390f29
f6172a2
cc505fc
 
 
 
f6172a2
6390f29
 
 
cc505fc
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Multi-stage build using the official ollama image
FROM ollama/ollama AS ollama

FROM cgr.dev/chainguard/wolfi-base

# Install required dependencies
RUN apk add --no-cache libstdc++

# Copy ollama binary from official image
COPY --from=ollama /usr/bin/ollama /usr/bin/ollama

# Copy all ollama lib files (this includes runners and other dependencies)
COPY --from=ollama /usr/lib/ollama /usr/lib/ollama

# Create ollama directory with proper permissions
RUN mkdir -p /root/.ollama && chmod 755 /root/.ollama

# Set environment variables for Hugging Face Spaces
ENV OLLAMA_HOST=0.0.0.0:7860

# Expose port 7860 for Hugging Face Spaces
EXPOSE 7860

# Set entrypoint and command
ENTRYPOINT ["/usr/bin/ollama"]
CMD ["serve"]