mac9087 commited on
Commit
251affc
·
verified ·
1 Parent(s): 599d025

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +2 -22
Dockerfile CHANGED
@@ -1,17 +1,10 @@
1
- # Use a lightweight Python image
2
  FROM python:3.10-slim
3
-
4
- # Set working directory
5
  WORKDIR /app
6
-
7
- # Set environment variables for Hugging Face cache
8
  ENV HF_HOME=/tmp/huggingface
9
  ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
10
  ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets
11
  ENV PYTHONDONTWRITEBYTECODE=1
12
  ENV PYTHONUNBUFFERED=1
13
-
14
- # Install system dependencies
15
  RUN apt-get update && apt-get install -y \
16
  build-essential \
17
  libgl1-mesa-glx \
@@ -21,31 +14,18 @@ RUN apt-get update && apt-get install -y \
21
  libxrender-dev \
22
  wget \
23
  git \
 
 
24
  && apt-get clean \
25
  && rm -rf /var/lib/apt/lists/*
26
-
27
- # Create necessary directories with appropriate permissions
28
  RUN mkdir -p /tmp/uploads /tmp/results /tmp/huggingface/transformers /tmp/huggingface/datasets \
29
  && chmod -R 777 /tmp/uploads /tmp/results /tmp/huggingface
30
-
31
- # Copy requirements file and install dependencies
32
  COPY requirements.txt .
33
  RUN pip install --no-cache-dir -U pip && \
34
  pip install --no-cache-dir -r requirements.txt
35
-
36
- # Download U^2-Net model file from Google Drive
37
  RUN gdown https://drive.google.com/uc?id=1ao1ovG1Qtx4b7EoskHXmi2E9rp5CHLcZ -O u2net.pth
38
-
39
- # Copy tsr module, U^2-Net module, and application code
40
- COPY tsr /app/tsr
41
  COPY u2net.py .
42
  COPY app.py .
43
-
44
- # Cache bust to ensure fresh build
45
  RUN echo "Build $(date)"
46
-
47
- # Expose the port the app runs on (standard for Hugging Face Spaces)
48
  EXPOSE 7860
49
-
50
- # Command to run the application
51
  CMD ["python", "app.py"]
 
 
1
  FROM python:3.10-slim
 
 
2
  WORKDIR /app
 
 
3
  ENV HF_HOME=/tmp/huggingface
4
  ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
5
  ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets
6
  ENV PYTHONDONTWRITEBYTECODE=1
7
  ENV PYTHONUNBUFFERED=1
 
 
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
  libgl1-mesa-glx \
 
14
  libxrender-dev \
15
  wget \
16
  git \
17
+ cmake \
18
+ g++ \
19
  && apt-get clean \
20
  && rm -rf /var/lib/apt/lists/*
 
 
21
  RUN mkdir -p /tmp/uploads /tmp/results /tmp/huggingface/transformers /tmp/huggingface/datasets \
22
  && chmod -R 777 /tmp/uploads /tmp/results /tmp/huggingface
 
 
23
  COPY requirements.txt .
24
  RUN pip install --no-cache-dir -U pip && \
25
  pip install --no-cache-dir -r requirements.txt
 
 
26
  RUN gdown https://drive.google.com/uc?id=1ao1ovG1Qtx4b7EoskHXmi2E9rp5CHLcZ -O u2net.pth
 
 
 
27
  COPY u2net.py .
28
  COPY app.py .
 
 
29
  RUN echo "Build $(date)"
 
 
30
  EXPOSE 7860
 
 
31
  CMD ["python", "app.py"]