webapp1 commited on
Commit
d67ae34
·
verified ·
1 Parent(s): 963e46c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -10
Dockerfile CHANGED
@@ -1,37 +1,37 @@
1
  # Use an official Python runtime as a parent image
2
  FROM python:3.11-slim
3
 
4
- # Set environment variables to ensure output is logged and no .pyc files are made
5
  ENV PYTHONDONTWRITEBYTECODE 1
6
  ENV PYTHONUNBUFFERED 1
7
 
8
- # Install system dependencies for OpenCV, EasyOCR, and building extensions
9
  RUN apt-get update && apt-get install -y \
10
- libgl1-mesa-glx \
11
  libglib2.0-0 \
12
  build-essential \
13
  python3-dev \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
- # Set working directory
17
  WORKDIR /app
18
 
19
- # Copy and install Python dependencies
20
  COPY requirements.txt .
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
23
- # Create application directories and set permissions
24
  RUN mkdir -p uploads models templates
25
  RUN chmod 777 uploads
26
 
27
- # Copy the application source code
28
  COPY app.py .
29
  COPY templates/index.html ./templates/
30
- # Note: Ensure you upload your model files to the /models folder in your repo
31
  COPY models/ ./models/
32
 
33
- # Hugging Face Spaces default to port 7860
34
  EXPOSE 7860
35
 
36
- # Run the Flask application
37
  CMD ["python", "app.py"]
 
1
  # Use an official Python runtime as a parent image
2
  FROM python:3.11-slim
3
 
4
+ # Set environment variables
5
  ENV PYTHONDONTWRITEBYTECODE 1
6
  ENV PYTHONUNBUFFERED 1
7
 
8
+ # FIX: Use 'libgl1' instead of the deprecated 'libgl1-mesa-glx'
9
  RUN apt-get update && apt-get install -y \
10
+ libgl1 \
11
  libglib2.0-0 \
12
  build-essential \
13
  python3-dev \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
+ # Set the working directory
17
  WORKDIR /app
18
 
19
+ # Copy requirements and install
20
  COPY requirements.txt .
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
23
+ # Create necessary folders and set permissions
24
  RUN mkdir -p uploads models templates
25
  RUN chmod 777 uploads
26
 
27
+ # Copy the rest of the application
28
  COPY app.py .
29
  COPY templates/index.html ./templates/
30
+ # Note: Ensure you upload your model files to the /models folder in your HF Repo
31
  COPY models/ ./models/
32
 
33
+ # Hugging Face Spaces run on port 7860
34
  EXPOSE 7860
35
 
36
+ # Run the application
37
  CMD ["python", "app.py"]