niloydebbarma commited on
Commit
1cbe075
·
verified ·
1 Parent(s): 50e280d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +61 -66
Dockerfile CHANGED
@@ -1,66 +1,61 @@
1
- FROM python:3.11-slim
2
-
3
- # Build arguments for conditional installation
4
- ARG INSTALL_OLLAMA=false
5
- ARG INSTALL_LOCAL_VECTOR_DB=false
6
-
7
- # Set working directory
8
- WORKDIR /allycat
9
-
10
- # Set environment variables - Cloud-first defaults
11
- ENV PYTHONDONTWRITEBYTECODE=1 \
12
- PYTHONUNBUFFERED=1 \
13
- LLM_RUN_ENV=cloud \
14
- VECTOR_DB_TYPE=cloud_zilliz
15
-
16
-
17
- # Install minimal system dependencies
18
- RUN apt-get update && apt-get install -y --no-install-recommends \
19
- bash \
20
- curl \
21
- git \
22
- netcat-traditional \
23
- && apt-get clean \
24
- && rm -rf /var/lib/apt/lists/*
25
-
26
- # Copy requirements file - Use cloud-optimized by default
27
- COPY requirements-docker-cloud.txt .
28
-
29
- # Install Python dependencies
30
- RUN pip install --no-cache-dir -r requirements-docker-cloud.txt
31
-
32
- # Conditional: Install Ollama only if requested
33
- RUN if [ "$INSTALL_OLLAMA" = "true" ]; then \
34
- echo "Installing Ollama for local LLM support..."; \
35
- curl -fsSL https://ollama.com/install.sh | sh; \
36
- else \
37
- echo "Skipping Ollama installation - using cloud LLM mode"; \
38
- fi
39
-
40
- # Conditional: Install local vector DB dependencies
41
- RUN if [ "$INSTALL_LOCAL_VECTOR_DB" = "true" ]; then \
42
- echo "Installing milvus-lite for local vector database..."; \
43
- pip install --no-cache-dir milvus-lite==2.4.11; \
44
- else \
45
- echo "Skipping local vector DB - using Zilliz Cloud"; \
46
- fi
47
-
48
- # Copy project files
49
- COPY . .
50
- RUN chmod +x ./docker-startup.sh
51
-
52
- # Cleanup unnecessary files
53
- RUN rm -rf .env workspace/* __pycache__ *.pyc
54
-
55
- # Expose all application ports (EXPOSE doesn't support env variables at build time)
56
- # Port 8080 = FLASK_GRAPH_PORT (default) / DOCKER_APP_PORT (default)
57
- # Port 8081 = FLASK_VECTOR_PORT (default)
58
- # Port 8082 = CHAINLIT_VECTOR_PORT (default)
59
- # Port 8083 = CHAINLIT_GRAPH_PORT (default)
60
- # Port mapping controlled by docker-compose.yml: ${DOCKER_PORT}:${DOCKER_APP_PORT}
61
- EXPOSE 8080 8081 8082 8083
62
- # Port 11434 = OLLAMA_PORT (default) - only used if INSTALL_OLLAMA=true
63
- EXPOSE 11434
64
-
65
- ENTRYPOINT ["./docker-startup.sh"]
66
- CMD ["deploy"]
 
1
+ # ============================================================
2
+ # AllyCat – Flask Graph + RAG (Cloud / Local optional)
3
+ # Hugging Face Spaces–ready Dockerfile
4
+ # ============================================================
5
+
6
+ FROM python:3.11-slim
7
+
8
+ # --- Build args for optional features -----------------------
9
+ ARG INSTALL_OLLAMA=false
10
+ ARG INSTALL_LOCAL_VECTOR_DB=false
11
+
12
+ # --- Workdir & environment ----------------------------------
13
+ WORKDIR /allycat
14
+ ENV PYTHONDONTWRITEBYTECODE=1 \
15
+ PYTHONUNBUFFERED=1 \
16
+ LLM_RUN_ENV=cloud \
17
+ VECTOR_DB_TYPE=cloud_zilliz \
18
+ HF_SPACE=true
19
+
20
+ # --- Base system deps ---------------------------------------
21
+ RUN apt-get update && apt-get install -y --no-install-recommends \
22
+ bash curl git netcat-traditional dos2unix \
23
+ && apt-get clean \
24
+ && rm -rf /var/lib/apt/lists/*
25
+
26
+ # --- Python deps --------------------------------------------
27
+ COPY requirements-docker-cloud.txt .
28
+ RUN pip install --no-cache-dir -r requirements-docker-cloud.txt
29
+
30
+ # --- Conditional installs -----------------------------------
31
+ RUN if [ "$INSTALL_OLLAMA" = "true" ]; then \
32
+ echo "Installing Ollama (local LLM mode)"; \
33
+ curl -fsSL https://ollama.com/install.sh | sh; \
34
+ else \
35
+ echo "Skipping Ollama using cloud LLM mode"; \
36
+ fi
37
+
38
+ RUN if [ "$INSTALL_LOCAL_VECTOR_DB" = "true" ]; then \
39
+ echo "Installing Milvus-lite (local vector DB)"; \
40
+ pip install --no-cache-dir milvus-lite==2.4.11; \
41
+ else \
42
+ echo "Skipping local vector DB – using Zilliz Cloud"; \
43
+ fi
44
+
45
+ # --- Copy project files -------------------------------------
46
+ COPY . .
47
+ RUN dos2unix docker-startup.sh && chmod +x docker-startup.sh
48
+
49
+ # --- Clean temporary files ----------------------------------
50
+ RUN rm -rf __pycache__ *.pyc
51
+
52
+ # --- Port & startup (Hugging Face exposes 7860) -------------
53
+ EXPOSE 7860
54
+
55
+ CMD bash -c "\
56
+ echo '🚀 Starting AllyCat on Hugging Face...'; \
57
+ if [ -f ./docker-startup.sh ]; then \
58
+ ./docker-startup.sh deploy; \
59
+ else \
60
+ python app_flask_graph.py; \
61
+ fi"