Spaces:
Running
Running
Commit ·
1b08040
1
Parent(s): 2ecc4a7
Final Build: Dockeerized Frontend/Backend with full RAG multi-format support
Browse files
RAG_FULL_APPLICATION_BACKEND/Dockerfile
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
FROM python:3.
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
# System deps for python-docx, tiktoken, etc.
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
-
build-essential libpq-dev && \
|
| 8 |
rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
COPY requirements.txt .
|
|
|
|
| 1 |
+
FROM python:3.12-slim
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
# System deps for python-docx, tiktoken, etc.
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
+
build-essential libpq-dev tesseract-ocr libmagic1 libgl1 && \
|
| 8 |
rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
COPY requirements.txt .
|
RAG_FULL_APPLICATION_BACKEND/requirements.txt
CHANGED
|
@@ -9,7 +9,7 @@ python-jose[cryptography]==3.3.0
|
|
| 9 |
passlib[bcrypt]==1.7.4
|
| 10 |
python-multipart==0.0.9
|
| 11 |
httpx==0.27.0
|
| 12 |
-
gradio_client=
|
| 13 |
tiktoken==0.7.0
|
| 14 |
python-docx==1.1.2
|
| 15 |
rank_bm25==0.2.2
|
|
|
|
| 9 |
passlib[bcrypt]==1.7.4
|
| 10 |
python-multipart==0.0.9
|
| 11 |
httpx==0.27.0
|
| 12 |
+
gradio_client>=1.0.0
|
| 13 |
tiktoken==0.7.0
|
| 14 |
python-docx==1.1.2
|
| 15 |
rank_bm25==0.2.2
|
RAG_FULL_APPLICATION_FRONTEND/Dockerfile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Build stage
|
| 2 |
+
FROM node:20-alpine as build-stage
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
# Add this line to accept the variable during build
|
| 6 |
+
ARG VITE_API_BASE_URL
|
| 7 |
+
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
|
| 8 |
+
|
| 9 |
+
COPY package*.json ./
|
| 10 |
+
RUN npm install
|
| 11 |
+
COPY . .
|
| 12 |
+
# Note: VITE_API_BASE_URL will be injected by docker-compose
|
| 13 |
+
RUN npm run build
|
| 14 |
+
|
| 15 |
+
# Production stage
|
| 16 |
+
FROM nginx:stable-alpine as production-stage
|
| 17 |
+
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
| 18 |
+
# Add Nginx config for SPA routing (important!)
|
| 19 |
+
RUN echo "server { listen 80; location / { root /usr/share/nginx/html; index index.html; try_files \$uri \$uri/ /index.html; } }" > /etc/nginx/conf.d/default.conf
|
| 20 |
+
EXPOSE 80
|
| 21 |
+
CMD ["nginx", "-g", "daemon off;"]
|
docker-compose.yml
CHANGED
|
@@ -2,20 +2,31 @@ version: "3.9"
|
|
| 2 |
|
| 3 |
services:
|
| 4 |
backend:
|
| 5 |
-
build:
|
| 6 |
-
context: ./
|
| 7 |
dockerfile: Dockerfile
|
| 8 |
ports:
|
| 9 |
- "8001:8000"
|
| 10 |
env_file:
|
| 11 |
-
- ./
|
| 12 |
volumes:
|
| 13 |
-
- ./
|
| 14 |
-
- ./
|
| 15 |
depends_on:
|
| 16 |
- redis
|
| 17 |
restart: unless-stopped
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
redis:
|
| 20 |
image: redis:7-alpine
|
| 21 |
ports:
|
|
|
|
| 2 |
|
| 3 |
services:
|
| 4 |
backend:
|
| 5 |
+
build:
|
| 6 |
+
context: ./RAG_FULL_APPLICATION_BACKEND
|
| 7 |
dockerfile: Dockerfile
|
| 8 |
ports:
|
| 9 |
- "8001:8000"
|
| 10 |
env_file:
|
| 11 |
+
- ./RAG_FULL_APPLICATION_BACKEND/.env
|
| 12 |
volumes:
|
| 13 |
+
- ./RAG_FULL_APPLICATION_BACKEND:/app
|
| 14 |
+
- ./RAG_FULL_APPLICATION_BACKEND/data:/app/data
|
| 15 |
depends_on:
|
| 16 |
- redis
|
| 17 |
restart: unless-stopped
|
| 18 |
|
| 19 |
+
frontend:
|
| 20 |
+
build:
|
| 21 |
+
context: ./RAG_FULL_APPLICATION_FRONTEND
|
| 22 |
+
dockerfile: Dockerfile
|
| 23 |
+
args:
|
| 24 |
+
- VITE_API_BASE_URL=http://localhost:8001
|
| 25 |
+
ports:
|
| 26 |
+
- "5173:80"
|
| 27 |
+
depends_on:
|
| 28 |
+
- backend
|
| 29 |
+
|
| 30 |
redis:
|
| 31 |
image: redis:7-alpine
|
| 32 |
ports:
|