ManglamX commited on
Commit
1047223
·
1 Parent(s): 8d095ff

chore: prepare for Strategy 1 deployment (spacy, docker, api config)

Browse files
backend/Dockerfile ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # backend/Dockerfile
2
+ FROM python:3.11-slim
3
+
4
+ WORKDIR /app
5
+
6
+ # Install system dependencies
7
+ RUN apt-get update && apt-get install -y \
8
+ build-essential \
9
+ curl \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Copy requirements and install
13
+ COPY requirements.txt .
14
+ RUN pip install --no-cache-dir -r requirements.txt
15
+ RUN python -m spacy download en_core_web_sm
16
+
17
+ # Copy the rest of the backend files
18
+ COPY . .
19
+
20
+ EXPOSE 8000
21
+
22
+ # Run uvicorn
23
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
backend/requirements.txt CHANGED
@@ -9,3 +9,6 @@ xgboost>=2.0.0
9
  scikit-learn>=1.4.0
10
  thefuzz>=0.22.0
11
  python-Levenshtein>=0.25.0
 
 
 
 
9
  scikit-learn>=1.4.0
10
  thefuzz>=0.22.0
11
  python-Levenshtein>=0.25.0
12
+ spacy>=3.7.0
13
+ transformers>=4.40.0
14
+ torch>=2.2.0
docker-compose.yml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3.8'
2
+
3
+ services:
4
+ backend:
5
+ build:
6
+ context: ./backend
7
+ ports:
8
+ - "8000:8000"
9
+ volumes:
10
+ - ./models:/app/models
11
+ - ./data:/app/data
12
+ restart: always
13
+
14
+ frontend:
15
+ build:
16
+ context: ./frontend
17
+ ports:
18
+ - "3000:3000"
19
+ environment:
20
+ - NEXT_PUBLIC_API_URL=http://localhost:8000
21
+ depends_on:
22
+ - backend
23
+ restart: always
frontend/Dockerfile ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # frontend/Dockerfile
2
+ FROM node:20-slim AS builder
3
+
4
+ WORKDIR /app
5
+ COPY package*.json ./
6
+ RUN npm install
7
+ COPY . .
8
+
9
+ # Set the production API URL (can be overridden at runtime or build time)
10
+ ARG NEXT_PUBLIC_API_URL=http://localhost:8000
11
+ ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
12
+
13
+ RUN npm run build
14
+
15
+ FROM node:20-slim AS runner
16
+ WORKDIR /app
17
+ COPY --from=builder /app/.next ./.next
18
+ COPY --from=builder /app/package*.json ./
19
+ COPY --from=builder /app/public ./public
20
+ COPY --from=builder /app/node_modules ./node_modules
21
+
22
+ EXPOSE 3000
23
+ CMD ["npm", "start"]