mohsin-devs commited on
Commit
b1df25f
Β·
1 Parent(s): 5101a73

Switch to Docker deployment with full backend + frontend support

Browse files
Files changed (4) hide show
  1. .dockerignore +16 -0
  2. Dockerfile +28 -0
  3. README.md +1 -3
  4. app.js +13 -1
.dockerignore ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .git
2
+ .gitignore
3
+ .DS_Store
4
+ __pycache__
5
+ *.pyc
6
+ .pytest_cache
7
+ .env
8
+ venv/
9
+ env/
10
+ logs/
11
+ data/
12
+ *.log
13
+ .vscode
14
+ .idea
15
+ node_modules
16
+ .env.local
Dockerfile ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use official Python runtime as a parent image
2
+ FROM python:3.10-slim
3
+
4
+ # Set working directory in container
5
+ WORKDIR /app
6
+
7
+ # Copy requirements first for better caching
8
+ COPY server/requirements.txt .
9
+
10
+ # Install Python dependencies
11
+ RUN pip install --no-cache-dir -r requirements.txt
12
+
13
+ # Copy the entire project
14
+ COPY . .
15
+
16
+ # Create data and logs directories
17
+ RUN mkdir -p data logs
18
+
19
+ # Set environment variables
20
+ ENV FLASK_APP=server/app.py
21
+ ENV FLASK_ENV=production
22
+ ENV PYTHONUNBUFFERED=1
23
+
24
+ # Expose port 5000 for Flask
25
+ EXPOSE 5000
26
+
27
+ # Run the Flask application
28
+ CMD ["python", "-m", "flask", "run", "--host", "0.0.0.0"]
README.md CHANGED
@@ -3,9 +3,7 @@ title: DocVault App
3
  emoji: πŸ“
4
  colorFrom: blue
5
  colorTo: purple
6
- sdk: static
7
- app_file: index.html
8
- pinned: false
9
  ---
10
 
11
  # DocVault - Offline-First Document Storage System
 
3
  emoji: πŸ“
4
  colorFrom: blue
5
  colorTo: purple
6
+ sdk: docker
 
 
7
  ---
8
 
9
  # DocVault - Offline-First Document Storage System
app.js CHANGED
@@ -1,7 +1,19 @@
1
  // DocVault β€” Offline-First Document Storage System
2
  // Uses local Flask backend for all operations
3
 
4
- const API_BASE = 'http://localhost:5000/api';
 
 
 
 
 
 
 
 
 
 
 
 
5
  const USER_ID = 'default_user';
6
  const DEFAULT_FOLDER = '';
7
 
 
1
  // DocVault β€” Offline-First Document Storage System
2
  // Uses local Flask backend for all operations
3
 
4
+ // Determine API base URL based on environment
5
+ const API_BASE = (() => {
6
+ const host = window.location.hostname;
7
+ const isLocal = ['localhost', '127.0.0.1'].includes(host);
8
+
9
+ if (isLocal) {
10
+ return 'http://localhost:5000/api';
11
+ } else {
12
+ // For HF Spaces and other deployments, use root path
13
+ return '/api';
14
+ }
15
+ })();
16
+
17
  const USER_ID = 'default_user';
18
  const DEFAULT_FOLDER = '';
19