PMS61 commited on
Commit
fbd0a6b
·
1 Parent(s): eed52dc
Files changed (1) hide show
  1. Dockerfile +7 -9
Dockerfile CHANGED
@@ -4,10 +4,11 @@ FROM python:3.10-slim
4
  # Set the working directory in the container
5
  WORKDIR /code
6
 
7
- # Set the PYTHONPATH environment variable
8
  ENV PYTHONPATH="/code"
 
9
 
10
- # Install system dependencies required by your project (ffmpeg, opencv)
11
  RUN apt-get update && apt-get install -y --no-install-recommends \
12
  build-essential \
13
  ffmpeg \
@@ -15,19 +16,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
15
  libxext6 \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
- # Copy the dependencies file to the working directory
19
  COPY ./requirements.txt /code/requirements.txt
20
-
21
- # Install any needed packages specified in requirements.txt
22
- # We add gunicorn here for a production-ready web server
23
  RUN pip install --no-cache-dir --upgrade pip
24
  RUN pip install --no-cache-dir -r requirements.txt gunicorn gevent
25
 
26
- # Copy the rest of the application's code to the working directory
27
  COPY . /code/
28
 
29
- # Expose the port the app runs on (Hugging Face Spaces default is 7860)
30
  EXPOSE 7860
31
 
32
- # Command to run the application using Gunicorn with gevent workers
33
  CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "4", "--worker-class", "gevent", "--timeout", "600", "app:app"]
 
4
  # Set the working directory in the container
5
  WORKDIR /code
6
 
7
+ # Set environment variables for caching
8
  ENV PYTHONPATH="/code"
9
+ ENV HF_HOME="/code/.cache"
10
 
11
+ # Install system dependencies
12
  RUN apt-get update && apt-get install -y --no-install-recommends \
13
  build-essential \
14
  ffmpeg \
 
16
  libxext6 \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
+ # Copy and install Python dependencies
20
  COPY ./requirements.txt /code/requirements.txt
 
 
 
21
  RUN pip install --no-cache-dir --upgrade pip
22
  RUN pip install --no-cache-dir -r requirements.txt gunicorn gevent
23
 
24
+ # Copy the application code
25
  COPY . /code/
26
 
27
+ # Expose the port
28
  EXPOSE 7860
29
 
30
+ # Run the application
31
  CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "4", "--worker-class", "gevent", "--timeout", "600", "app:app"]