mac9087 commited on
Commit
1e13ee1
·
verified ·
1 Parent(s): e84c7ae

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -14
Dockerfile CHANGED
@@ -1,25 +1,41 @@
1
- # Use official CUDA base image
2
- FROM nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu20.04
3
 
4
- ENV DEBIAN_FRONTEND=noninteractive
5
- ENV PYTHON_VERSION=3.10
 
 
 
 
 
 
 
 
6
 
7
- # Install Python, pip, and dependencies
8
  RUN apt-get update && apt-get install -y \
9
- python3.10 python3.10-dev python3.10-distutils \
10
- curl git ffmpeg libsm6 libxext6 wget build-essential \
11
- && ln -s /usr/bin/python3.10 /usr/bin/python \
12
- && curl -sS https://bootstrap.pypa.io/get-pip.py | python
 
 
 
 
 
 
 
 
 
13
 
14
- # Set working directory
15
- WORKDIR /app
16
 
17
- # Install Python dependencies
18
  COPY requirements.txt .
19
- RUN pip install --upgrade pip && pip install -r requirements.txt
 
 
20
 
21
- # Copy app code
22
  COPY app.py .
23
 
24
  EXPOSE 7860
 
25
  CMD ["python", "app.py"]
 
1
+ FROM python:3.10-slim
 
2
 
3
+ WORKDIR /app
4
+
5
+ ENV HF_HOME=/tmp/huggingface
6
+ ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
7
+ ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets
8
+
9
+ ENV PYTHONDONTWRITEBYTECODE=1
10
+ ENV PYTHONUNBUFFERED=1
11
+ ENV CUDA_VISIBLE_DEVICES=""
12
+ ENV HF_TOKEN=${HF_TOKEN}
13
 
 
14
  RUN apt-get update && apt-get install -y \
15
+ build-essential \
16
+ git \
17
+ libgl1-mesa-glx \
18
+ libglib2.0-0 \
19
+ libsm6 \
20
+ libxext6 \
21
+ libxrender-dev \
22
+ cmake \
23
+ libopenblas-dev \
24
+ liblapack-dev \
25
+ libopencv-dev \
26
+ && apt-get clean \
27
+ && rm -rf /var/lib/apt/lists/*
28
 
29
+ RUN mkdir -p /tmp/uploads /tmp/results /tmp/huggingface/transformers /tmp/huggingface/datasets \
30
+ && chmod -R 777 /tmp/uploads /tmp/results /tmp/huggingface
31
 
 
32
  COPY requirements.txt .
33
+ RUN pip install --no-cache-dir -U pip && \
34
+ pip install --no-cache-dir -r requirements.txt && \
35
+ pip cache purge
36
 
 
37
  COPY app.py .
38
 
39
  EXPOSE 7860
40
+
41
  CMD ["python", "app.py"]