sohamnk commited on
Commit
d396bd7
·
verified ·
1 Parent(s): 6091dd7
Files changed (1) hide show
  1. Dockerfile +3 -12
Dockerfile CHANGED
@@ -1,34 +1,25 @@
1
- # Use an official Python runtime as a parent image
2
  FROM python:3.10-slim
3
 
4
- # Set the working directory in the container
5
  WORKDIR /code
6
 
7
- # --- FIX FOR PERMISSION ERROR ---
8
- # 1. Set environment variables to tell libraries where to cache files.
9
  ENV HF_HOME=/tmp/huggingface_cache
10
  ENV TORCH_HOME=/tmp/torch_cache
11
 
12
- # 2. Explicitly create the cache directory and give it open permissions.
13
- # This is safe within a container and ensures the application can write here.
14
  RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME
15
  RUN mkdir -p $TORCH_HOME && chmod -R 777 $TORCH_HOME
16
 
17
- # Install system dependencies required by OpenCV
18
  RUN apt-get update && apt-get install -y \
19
  libgl1-mesa-glx \
20
  libglib2.0-0 \
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
- # Copy the requirements file into the container
24
  COPY ./requirements.txt /code/requirements.txt
25
 
26
- # Install the Python packages
27
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
28
 
29
- # Copy the rest of your application files into the container
30
  COPY . /code/
31
 
32
- # Tell Gunicorn to run your app on the port Hugging Face expects (7860)
33
- # The --timeout flag prevents the server from crashing during long model-loading times.
34
  CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--timeout", "300", "app:app"]
 
 
1
  FROM python:3.10-slim
2
 
3
+ # working directory
4
  WORKDIR /code
5
 
 
 
6
  ENV HF_HOME=/tmp/huggingface_cache
7
  ENV TORCH_HOME=/tmp/torch_cache
8
 
9
+ # explicitly create cache directory
 
10
  RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME
11
  RUN mkdir -p $TORCH_HOME && chmod -R 777 $TORCH_HOME
12
 
13
+ # dependency req by open cv
14
  RUN apt-get update && apt-get install -y \
15
  libgl1-mesa-glx \
16
  libglib2.0-0 \
17
  && rm -rf /var/lib/apt/lists/*
18
 
 
19
  COPY ./requirements.txt /code/requirements.txt
20
 
 
21
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
22
 
 
23
  COPY . /code/
24
 
 
 
25
  CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--timeout", "300", "app:app"]