Yadav122 commited on
Commit
f6dc4cc
·
verified ·
1 Parent(s): 9a4ef1a

Fix: Simplified Dockerfile for better compatibility

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -13
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM python:3.9-slim
2
 
3
  # Set working directory
4
  WORKDIR /app
@@ -7,21 +7,19 @@ WORKDIR /app
7
  RUN apt-get update && apt-get install -y \
8
  build-essential \
9
  curl \
10
- software-properties-common \
11
- git \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # Copy requirements first for better caching
15
- COPY requirements_new.txt requirements.txt
16
-
17
- # Install Python dependencies
18
  RUN pip install --no-cache-dir -r requirements.txt
19
 
20
  # Copy application code
21
  COPY . .
22
 
23
- # Create non-root user
24
  RUN useradd -m -u 1000 user
 
25
  USER user
26
 
27
  # Set environment variables
@@ -30,12 +28,8 @@ ENV HOME=/home/user \
30
  PYTHONPATH=/app \
31
  PYTHONUNBUFFERED=1
32
 
33
- # Expose port
34
  EXPOSE 7860
35
 
36
- # Health check
37
- HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
38
- CMD curl -f http://localhost:7860/health || exit 1
39
-
40
  # Run the application
41
  CMD ["python", "app.py"]
 
1
+ FROM python:3.10-slim
2
 
3
  # Set working directory
4
  WORKDIR /app
 
7
  RUN apt-get update && apt-get install -y \
8
  build-essential \
9
  curl \
 
 
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Copy requirements and install dependencies
13
+ COPY requirements.txt .
14
+ RUN pip install --no-cache-dir --upgrade pip
 
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
  # Copy application code
18
  COPY . .
19
 
20
+ # Create non-root user for security
21
  RUN useradd -m -u 1000 user
22
+ RUN chown -R user:user /app
23
  USER user
24
 
25
  # Set environment variables
 
28
  PYTHONPATH=/app \
29
  PYTHONUNBUFFERED=1
30
 
31
+ # Expose port 7860 (required by Hugging Face Spaces)
32
  EXPOSE 7860
33
 
 
 
 
 
34
  # Run the application
35
  CMD ["python", "app.py"]