mac9087 commited on
Commit
ac1a7b9
·
verified ·
1 Parent(s): 9b9b942

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -6
Dockerfile CHANGED
@@ -1,10 +1,17 @@
 
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 \
@@ -12,20 +19,32 @@ RUN apt-get update && apt-get install -y \
12
  libsm6 \
13
  libxext6 \
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"]
 
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 \
 
19
  libsm6 \
20
  libxext6 \
21
  libxrender-dev \
 
22
  git \
 
 
23
  && apt-get clean \
24
  && rm -rf /var/lib/apt/lists/*
25
+
26
+ # Install additional dependencies for PyMeshLab
27
+ RUN apt-get update && apt-get install -y \
28
+ libeigen3-dev \
29
+ libgmp-dev \
30
+ libmpfr-dev \
31
+ && apt-get clean \
32
+ && rm -rf /var/lib/apt/lists/*
33
+
34
+ # Create necessary directories with appropriate permissions
35
  RUN mkdir -p /tmp/uploads /tmp/results /tmp/huggingface/transformers /tmp/huggingface/datasets \
36
  && chmod -R 777 /tmp/uploads /tmp/results /tmp/huggingface
37
+
38
+ # Copy requirements file and install dependencies
39
  COPY requirements.txt .
40
  RUN pip install --no-cache-dir -U pip && \
41
  pip install --no-cache-dir -r requirements.txt
42
+
43
+ # Copy application code
44
  COPY app.py .
45
+
46
+ # Expose the port the app runs on (standard for Hugging Face Spaces)
47
  EXPOSE 7860
48
+
49
+ # Command to run the application
50
  CMD ["python", "app.py"]