itsjarvis commited on
Commit
193e526
·
verified ·
1 Parent(s): 061bcee

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -25
Dockerfile CHANGED
@@ -1,14 +1,9 @@
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
@@ -16,38 +11,36 @@ WORKDIR /app
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"
 
1
+ # SuperKart Sales Forecasting Frontend - Docker Configuration
2
+ FROM python:3.10-slim
3
 
4
+ # Set environment variables for Python
 
 
 
5
  ENV PYTHONDONTWRITEBYTECODE=1
6
  ENV PYTHONUNBUFFERED=1
 
 
7
 
8
  # Set working directory
9
  WORKDIR /app
 
11
  # Install system dependencies
12
  RUN apt-get update \
13
  && apt-get install -y --no-install-recommends \
 
 
14
  curl \
15
+ gcc \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
+ # Copy requirements file first for better Docker layer caching
19
  COPY requirements.txt .
20
 
21
  # Install Python dependencies
22
+ RUN pip install --no-cache-dir --upgrade pip \
23
+ && pip install --no-cache-dir -r requirements.txt
24
 
25
  # Copy application files
26
  COPY . .
27
 
28
  # Create non-root user for security
29
+ RUN adduser --disabled-password --gecos '' streamlituser \
30
+ && chown -R streamlituser:streamlituser /app
31
+ USER streamlituser
 
 
32
 
33
+ # Expose Streamlit port
34
+ EXPOSE 8501
 
35
 
36
+ # Health check for Streamlit
37
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
38
+ CMD curl -f http://localhost:8501/_stcore/health || exit 1
39
 
40
+ # Run Streamlit app
41
+ CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false", "--server.enableCORS=false"]
42
 
43
  # Container metadata
44
  LABEL maintainer="SuperKart ML Team"
45
  LABEL version="1.0"
46
+ LABEL description="SuperKart Sales Forecasting Streamlit Frontend"