Noblhyon commited on
Commit
0f40c32
·
verified ·
1 Parent(s): 81ebac6

Update Dockerfile

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