d-e-e-k-11 commited on
Commit
ba68dcb
·
verified ·
1 Parent(s): 6614df8

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. Dockerfile +15 -13
  2. requirements.txt +3 -2
Dockerfile CHANGED
@@ -8,28 +8,30 @@ WORKDIR /app
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
  libgl1-mesa-glx \
 
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # Copy the requirements file into the container
14
  COPY requirements.txt .
 
 
15
 
16
- # Install any needed packages specified in requirements.txt
17
- RUN pip install --no-cache-dir -r requirements.txt
18
-
19
- # Copy everything from the current directory (where Dockerfile is)
20
  COPY . .
21
 
22
- # Create uploads directory
23
- RUN mkdir -p uploads && chmod 777 uploads
 
 
 
 
 
24
 
25
- # Create a non-root user and switch to it (Hugging Face Recommended)
26
- RUN useradd -m -u 1000 user
27
- USER user
28
  ENV HOME=/home/user \
29
  PATH=/home/user/.local/bin:$PATH
30
 
31
- # Expose port 7860 (Hugging Face default)
32
  EXPOSE 7860
33
 
34
- # Command to run the application using gunicorn
35
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "server:app"]
 
 
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
  libgl1-mesa-glx \
11
+ libglib2.0-0 \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Copy requirements and install
15
  COPY requirements.txt .
16
+ RUN pip install --no-cache-dir --upgrade pip && \
17
+ pip install --no-cache-dir -r requirements.txt
18
 
19
+ # Copy the rest of the application
 
 
 
20
  COPY . .
21
 
22
+ # Create uploads and set permissions for user 1000
23
+ RUN mkdir -p /app/uploads && \
24
+ chmod -R 777 /app/uploads && \
25
+ chown -R 1000:1000 /app
26
+
27
+ # Swtich to the user with id 1000
28
+ USER 1000
29
 
 
 
 
30
  ENV HOME=/home/user \
31
  PATH=/home/user/.local/bin:$PATH
32
 
 
33
  EXPOSE 7860
34
 
35
+ # Run gunicorn with increased timeout for model loading
36
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "server:app", "--timeout", "120", "--workers", "1"]
37
+
requirements.txt CHANGED
@@ -1,6 +1,7 @@
1
- tensorflow==2.15.0
 
2
  matplotlib
3
- numpy
4
  flask
5
  Pillow
6
  gunicorn
 
 
1
+ tensorflow-cpu==2.15.0
2
+ numpy==1.26.4
3
  matplotlib
 
4
  flask
5
  Pillow
6
  gunicorn
7
+ h5py