Miroir commited on
Commit
87ac8bd
·
1 Parent(s): b9f6a03

added logs to docker build

Browse files
.gitignore ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dependencies
2
+ node_modules/
3
+ /.pnp
4
+ .pnp.js
5
+
6
+ # Python
7
+ __pycache__/
8
+ *.py[cod]
9
+ *$py.class
10
+ *.so
11
+ .Python
12
+ env/
13
+ venv/
14
+ build/
15
+ develop-eggs/
16
+ dist/
17
+ downloads/
18
+ eggs/
19
+ .eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+
29
+ # Testing
30
+ /coverage
31
+ .pytest_cache/
32
+
33
+ # Production
34
+ /build
35
+
36
+ # Environment variables
37
+ .env
38
+ .env.local
39
+ .env.development.local
40
+ .env.test.local
41
+ .env.production.local
42
+
43
+ # Logs
44
+ *.log
45
+ npm-debug.log*
46
+ yarn-debug.log*
47
+ yarn-error.log*
48
+
49
+ # IDE specific files
50
+ .idea/
51
+ .vscode/
52
+ *.swp
53
+ *.swo
54
+
55
+ # Model files
56
+ backend/data/*.vec
57
+ backend/data/*.bin
58
+ backend/data/*.model
59
+ *.vec
60
+
61
+ # Temporary files
62
+ *.tmp
63
+
64
+ # Vercel
65
+ .vercel
Dockerfile CHANGED
@@ -3,13 +3,15 @@ FROM python:3.11-slim
3
  # Create user first
4
  RUN useradd -m -u 1000 user
5
 
6
- # Create cache directory and set permissions while still root
7
- RUN mkdir -p /tmp/fasttext_cache && chown -R user:user /tmp/fasttext_cache
 
8
 
9
  # Switch to user after setting up permissions
10
  USER user
11
  ENV PATH="/home/user/.local/bin:$PATH"
12
  ENV MODEL_URL="https://huggingface.co/Miroir/cc.fr.300.reduced/resolve/main/cc.fr.300.reduced.vec"
 
13
 
14
  WORKDIR /app
15
 
@@ -21,4 +23,21 @@ RUN pip install --no-cache-dir --upgrade pip && \
21
 
22
  COPY --chown=user . .
23
 
24
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  # Create user first
4
  RUN useradd -m -u 1000 user
5
 
6
+ # Create necessary directories
7
+ RUN mkdir -p /tmp/fasttext_cache /app/logs && \
8
+ chown -R user:user /tmp/fasttext_cache /app/logs
9
 
10
  # Switch to user after setting up permissions
11
  USER user
12
  ENV PATH="/home/user/.local/bin:$PATH"
13
  ENV MODEL_URL="https://huggingface.co/Miroir/cc.fr.300.reduced/resolve/main/cc.fr.300.reduced.vec"
14
+ ENV PYTHONUNBUFFERED=1
15
 
16
  WORKDIR /app
17
 
 
23
 
24
  COPY --chown=user . .
25
 
26
+ # Add healthcheck
27
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
28
+ CMD curl -f http://localhost:7860/ || exit 1
29
+
30
+ # Create startup script
31
+ COPY --chown=user <<EOF /app/start.sh
32
+ #!/bin/bash
33
+ echo "Starting application..."
34
+ echo "Checking MODEL_URL accessibility..."
35
+ curl --head --silent --fail ${MODEL_URL} || (echo "ERROR: Cannot access MODEL_URL" && exit 1)
36
+ echo "MODEL_URL is accessible"
37
+ echo "Starting uvicorn server..."
38
+ exec uvicorn app:app --host 0.0.0.0 --port 7860 --log-level info
39
+ EOF
40
+
41
+ RUN chmod +x /app/start.sh
42
+
43
+ CMD ["/app/start.sh"]
app.py CHANGED
@@ -89,4 +89,9 @@ async def get_visualization():
89
  @app.get("/")
90
  async def root():
91
  """Health check endpoint"""
92
- return {"status": "ok", "message": "Semantix API is running"}
 
 
 
 
 
 
89
  @app.get("/")
90
  async def root():
91
  """Health check endpoint"""
92
+ return {"status": "ok", "message": "Semantix API is running"}
93
+
94
+ if __name__ == "__main__":
95
+ import uvicorn
96
+ logger.info("Starting FastAPI server in development mode...")
97
+ uvicorn.run(app, host="0.0.0.0", port=8000, log_level="info")
services/__pycache__/game_service.cpython-311.pyc CHANGED
Binary files a/services/__pycache__/game_service.cpython-311.pyc and b/services/__pycache__/game_service.cpython-311.pyc differ
 
services/__pycache__/visualization_service.cpython-311.pyc CHANGED
Binary files a/services/__pycache__/visualization_service.cpython-311.pyc and b/services/__pycache__/visualization_service.cpython-311.pyc differ
 
services/__pycache__/word_service.cpython-311.pyc CHANGED
Binary files a/services/__pycache__/word_service.cpython-311.pyc and b/services/__pycache__/word_service.cpython-311.pyc differ