nativeshiftai commited on
Commit
144ff83
·
verified ·
1 Parent(s): 918c302

Create scripts/deploy.sh

Browse files
Files changed (1) hide show
  1. scripts/deploy.sh +41 -0
scripts/deploy.sh ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install system dependencies
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ libgl1-mesa-glx \
8
+ libglib2.0-0 \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ # Copy requirements first for better caching
12
+ COPY requirements.txt .
13
+ RUN pip install --no-cache-dir -r requirements.txt
14
+
15
+ # Create directories for app
16
+ RUN mkdir -p models examples static docs
17
+
18
+ # Copy application files
19
+ COPY app.py tflite_app.py ./
20
+ COPY scripts/ ./scripts/
21
+ COPY static/ ./static/
22
+ COPY docs/ ./docs/
23
+ COPY examples/ ./examples/
24
+
25
+ # Download model if not present (create a simple download script)
26
+ RUN echo '#!/bin/bash\n\
27
+ if [ ! -f models/waste_classification_model_initial.keras ]; then\n\
28
+ echo "Model file not found. Please mount the model volume or download it."\n\
29
+ exit 1\n\
30
+ fi' > download_model.sh && chmod +x download_model.sh
31
+
32
+ # Environment variables
33
+ ENV PYTHONUNBUFFERED=1
34
+ ENV GRADIO_SERVER_NAME=0.0.0.0
35
+ ENV GRADIO_SERVER_PORT=7860
36
+
37
+ # Expose port for the app
38
+ EXPOSE 7860
39
+
40
+ # Check if model exists and run the app
41
+ CMD ./download_model.sh && python app.py