File size: 777 Bytes
7aa14e3
 
f8fdbb0
 
7aa14e3
f8fdbb0
 
 
7aa14e3
f8fdbb0
 
 
 
 
 
 
 
 
 
 
7aa14e3
 
 
 
 
f8fdbb0
 
7aa14e3
 
 
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
28
29
30
FROM ghcr.io/open-webui/open-webui:main

# Create required directories first
RUN mkdir -p /app/backend

# Set environment variables
ENV PORT=7860
ENV DISABLE_GIT=true  # Disables Git repository initialization
ENV OLLAMA_API_BASE_URL=http://host.docker.internal:11434
ENV WEBUI_SECRET_KEY=your-secure-key-here-change-me

# Create data directory and set permissions
RUN mkdir -p /app/backend/data && \
    chown -R node:node /app/backend

# Switch to non-root user
USER node

# Expose port 7860 for Hugging Face Spaces
EXPOSE 7860

# Persist data volume
VOLUME /app/backend/data

# Health check
HEALTHCHECK --interval=30s --timeout=10s \
    CMD curl -f http://localhost:7860 || exit 1

# Start command
CMD ["sh", "-c", "python -m uvicorn main:app --host 0.0.0.0 --port ${PORT}"]