itsjarvis commited on
Commit
36f6f17
·
verified ·
1 Parent(s): 53ca950

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +53 -0
Dockerfile ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SuperKart Sales Forecasting API - Docker Configuration
2
+ # =====================================================
3
+
4
+ # Use Python 3.9 slim image for optimal size and compatibility
5
+ FROM python:3.9-slim
6
+
7
+ # Set environment variables
8
+ ENV PYTHONDONTWRITEBYTECODE=1
9
+ ENV PYTHONUNBUFFERED=1
10
+ ENV FLASK_APP=app.py
11
+ ENV FLASK_ENV=production
12
+
13
+ # Set working directory
14
+ WORKDIR /app
15
+
16
+ # Install system dependencies
17
+ RUN apt-get update \
18
+ && apt-get install -y --no-install-recommends \
19
+ gcc \
20
+ g++ \
21
+ curl \
22
+ && rm -rf /var/lib/apt/lists/*
23
+
24
+ # Copy requirements first for better Docker layer caching
25
+ COPY requirements.txt .
26
+
27
+ # Install Python dependencies
28
+ RUN pip install --no-cache-dir -r requirements.txt
29
+
30
+ # Copy application files
31
+ COPY . .
32
+
33
+ # Create non-root user for security
34
+ RUN adduser --disabled-password --gecos '' appuser && chown -R appuser:appuser /app
35
+ USER appuser
36
+
37
+ # Expose port
38
+ EXPOSE 8080
39
+
40
+ # Health check
41
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
42
+ CMD curl -f http://localhost:8080/health || exit 1
43
+
44
+ # Production command using Gunicorn
45
+ CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--workers", "2", "--timeout", "120", "--keep-alive", "2", "--max-requests", "1000", "--max-requests-jitter", "100", "app:app"]
46
+
47
+ # Development command (commented out)
48
+ # CMD ["python", "app.py"]
49
+
50
+ # Container metadata
51
+ LABEL maintainer="SuperKart ML Team"
52
+ LABEL version="1.0"
53
+ LABEL description="SuperKart Sales Forecasting API"