tkgray commited on
Commit
450fd87
·
verified ·
1 Parent(s): e07b951

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +53 -8
Dockerfile CHANGED
@@ -1,11 +1,56 @@
1
- FROM ghcr.io/open-webui/open-webui:main
 
2
 
3
- RUN apt-get update && apt-get install -y python3 python3-pip
4
- RUN pip3 install --no-cache-dir huggingface_hub
5
 
6
- COPY sync_data.sh sync_data.sh
 
7
 
8
- RUN chmod -R 777 ./data && \
9
- chmod -R 777 /app/backend/open_webui/static && \
10
- chmod +x sync_data.sh && \
11
- sed -i "1r sync_data.sh" ./start.sh
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Working Dockerfile for Perplexica with Authentication and Port Fix
2
+ FROM itzcrazykns1337/perplexica:latest
3
 
4
+ # Install curl for health checks
5
+ RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
6
 
7
+ # Create data directory
8
+ RUN mkdir -p /home/perplexica/data && chmod 777 /home/perplexica/data
9
 
10
+ # HuggingFace Spaces configuration
11
+ ENV PORT=7860
12
+ ENV HOST=0.0.0.0
13
+ ENV NODE_ENV=production
14
+
15
+ # Create startup script that properly handles authentication
16
+ RUN echo '#!/bin/bash' > /start.sh && \
17
+ echo 'echo "Starting Perplexica with authentication on port 7860..."' >> /start.sh && \
18
+ echo '' >> /start.sh && \
19
+ echo '# Get credentials from HuggingFace secrets' >> /start.sh && \
20
+ echo 'AUTH_USERNAME=${AUTH_USERNAME:-admin}' >> /start.sh && \
21
+ echo 'AUTH_PASSWORD=${AUTH_PASSWORD:-changeme123}' >> /start.sh && \
22
+ echo 'echo "Authentication configured for user: $AUTH_USERNAME"' >> /start.sh && \
23
+ echo '' >> /start.sh && \
24
+ echo '# Create config directory if it does not exist' >> /start.sh && \
25
+ echo 'mkdir -p /home/perplexica/data' >> /start.sh && \
26
+ echo '' >> /start.sh && \
27
+ echo '# Create config.toml line by line to avoid heredoc issues' >> /start.sh && \
28
+ echo 'echo "[GENERAL]" > /home/perplexica/config.toml' >> /start.sh && \
29
+ echo 'echo "PORT = 7860" >> /home/perplexica/config.toml' >> /start.sh && \
30
+ echo 'echo "SIMILARITY_MEASURE = \"cosine\"" >> /home/perplexica/config.toml' >> /start.sh && \
31
+ echo 'echo "AUTHENTICATION = true" >> /home/perplexica/config.toml' >> /start.sh && \
32
+ echo 'echo "" >> /home/perplexica/config.toml' >> /start.sh && \
33
+ echo 'echo "[AUTHENTICATION]" >> /home/perplexica/config.toml' >> /start.sh && \
34
+ echo 'echo "USERNAME = \"$AUTH_USERNAME\"" >> /home/perplexica/config.toml' >> /start.sh && \
35
+ echo 'echo "PASSWORD = \"$AUTH_PASSWORD\"" >> /home/perplexica/config.toml' >> /start.sh && \
36
+ echo 'echo "" >> /home/perplexica/config.toml' >> /start.sh && \
37
+ echo 'echo "[API_ENDPOINTS]" >> /home/perplexica/config.toml' >> /start.sh && \
38
+ echo 'echo "SEARXNG = \"http://localhost:8080\"" >> /home/perplexica/config.toml' >> /start.sh && \
39
+ echo '' >> /start.sh && \
40
+ echo 'cp /home/perplexica/config.toml /home/perplexica/data/config.toml' >> /start.sh && \
41
+ echo 'chmod 644 /home/perplexica/config.toml /home/perplexica/data/config.toml' >> /start.sh && \
42
+ echo 'echo "Configuration completed. Starting Perplexica..."' >> /start.sh && \
43
+ echo '' >> /start.sh && \
44
+ echo '# Start the application' >> /start.sh && \
45
+ echo 'exec "$@"' >> /start.sh && \
46
+ chmod +x /start.sh
47
+
48
+ # Health check
49
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
50
+ CMD curl -f http://localhost:7860/health || exit 1
51
+
52
+ # Expose port 7860 (required by HuggingFace Spaces)
53
+ EXPOSE 7860
54
+
55
+ # Use the start script as entrypoint to configure authentication
56
+ ENTRYPOINT ["/start.sh"]