satyakimitra commited on
Commit
1b3a7fa
·
1 Parent(s): 522f7a0

Fix Dockerfile syntax error

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -23
Dockerfile CHANGED
@@ -30,35 +30,29 @@ COPY . .
30
  # Create necessary directories
31
  RUN mkdir -p uploads cache logs cache/models models
32
 
33
- # Download pre-trained models in advance
34
- RUN python -c "
35
- from model_manager.model_loader import ModelLoader
36
- from config.settings import settings
37
- import logging
38
-
39
- # Configure basic logging
40
- logging.basicConfig(level=logging.INFO)
41
-
42
- try:
43
- print('Pre-downloading AI models...')
44
- loader = ModelLoader()
45
- loader.ensure_models_downloaded()
46
- print('All models downloaded successfully!')
47
- except Exception as e:
48
- print(f'Model download warning: {e}')
49
- print('Models will be downloaded on first use...')
50
  "
51
 
52
- # Start Ollama server and pull model in background
53
- RUN ollama serve &
54
- RUN sleep 10 && ollama pull llama3:8b &
55
-
56
  # Expose port (required for Hugging Face Spaces)
57
  EXPOSE 7860
58
 
59
  # Health check
60
  HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
61
- CMD curl -f http://localhost:7860/docs || exit 1
62
 
63
  # Start the application
64
  CMD ["sh", "-c", "
@@ -76,5 +70,5 @@ CMD ["sh", "-c", "
76
 
77
  # Start the FastAPI application
78
  echo 'Starting AI Contract Risk Analyzer...'
79
- uvicorn main:app --host 0.0.0.0 --port 7860 --reload
80
  "]
 
30
  # Create necessary directories
31
  RUN mkdir -p uploads cache logs cache/models models
32
 
33
+ # Download pre-trained models using a script file instead of inline Python
34
+ RUN python -c "\
35
+ import sys;\
36
+ sys.path.append('/app');\
37
+ try:\
38
+ from model_manager.model_loader import ModelLoader;\
39
+ import logging;\
40
+ logging.basicConfig(level=logging.INFO);\
41
+ print('Pre-downloading AI models...');\
42
+ loader = ModelLoader();\
43
+ loader.ensure_models_downloaded();\
44
+ print('All models downloaded successfully!');\
45
+ except Exception as e:\
46
+ print(f'Model download warning: {e}');\
47
+ print('Models will be downloaded on first use...');\
 
 
48
  "
49
 
 
 
 
 
50
  # Expose port (required for Hugging Face Spaces)
51
  EXPOSE 7860
52
 
53
  # Health check
54
  HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
55
+ CMD curl -f http://localhost:7860/health || exit 1
56
 
57
  # Start the application
58
  CMD ["sh", "-c", "
 
70
 
71
  # Start the FastAPI application
72
  echo 'Starting AI Contract Risk Analyzer...'
73
+ uvicorn app:app --host 0.0.0.0 --port 7860
74
  "]