fffiloni commited on
Commit
1bfdf22
1 Parent(s): 5401cd9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +40 -59
Dockerfile CHANGED
@@ -1,23 +1,9 @@
1
- FROM pytorch/pytorch:2.1.2-cuda11.8-cudnn8-devel
 
2
 
3
  # Set environment variables
4
  ENV DEBIAN_FRONTEND=noninteractive
5
 
6
- RUN apt-get update && apt-get install -y --no-install-recommends \
7
- git \
8
- cmake \
9
- build-essential \
10
- libgl1-mesa-glx \
11
- libglib2.0-0 \
12
- ffmpeg \
13
- python3.8 \
14
- python3-pip \
15
- python3.8-dev \
16
- && rm -rf /var/lib/apt/lists/*
17
-
18
- # Create a symlink for python
19
- RUN ln -s /usr/bin/python3 /usr/bin/python
20
-
21
  RUN useradd -m -u 1000 user
22
 
23
  USER user
@@ -33,58 +19,53 @@ ENV HOME=/home/user \
33
  GRADIO_SHARE=False \
34
  SYSTEM=spaces
35
 
36
- # Set CUDA_HOME environment variable
37
- ENV CUDA_HOME=/usr/local/cuda-11.8
38
- ENV TORCH_CUDA_ARCH_LIST="6.0;6.1;7.0;7.5;8.0;8.6+PTX;8.9;9.0"
39
- ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
40
 
41
- # Set the environment variable to specify the GPU device
42
- ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
43
- ENV CUDA_VISIBLE_DEVICES=0
 
 
 
 
 
 
 
 
 
 
44
 
45
- # Set the working directory to the user's home directory
46
- WORKDIR $HOME
 
47
 
 
48
  # Clone the repository (adjust the URL if needed)
49
- RUN git clone --recursive https://github.com/jnjaby/KEEP.git app
50
 
51
- # Set the working directory to the app directory
52
- WORKDIR $HOME/app
 
53
 
54
- # Copy the app.py script and requirements file into the container
55
- COPY --chown=user:user app.py .
56
- COPY --chown=user:user requirements_HF.txt .
 
 
57
 
58
- # Debug: List contents of the app directory and its subdirectories
59
- RUN echo "Contents of $HOME/app:" && \
60
- ls -R $HOME/app
61
 
62
- # Install Python dependencies
63
- RUN pip install --upgrade pip && \
64
- pip install -r requirements_HF.txt && \
65
- pip install gradio && \
66
- pip install "numpy<1.25,>=1.18" && \
67
- pip install cupy-cuda11x && \
68
- pip install ffmpeg-python dlib
69
 
70
- # Install basicsr
71
- RUN cd basicsr && \
72
- if [ -f "VERSION" ]; then \
73
- echo "VERSION file found at basicsr/VERSION"; \
74
- cat VERSION; \
75
- # Create the VERSION file in the location expected by setup.py
76
- mkdir -p basicsr && cp VERSION basicsr/VERSION; \
77
- else \
78
- echo "VERSION file not found, this is unexpected"; \
79
- exit 1; \
80
- fi && \
81
- echo "Current working directory: $(pwd)" && \
82
- echo "Contents of current directory:" && \
83
- ls -la && \
84
- echo "Contents of basicsr subdirectory:" && \
85
- ls -la basicsr && \
86
- echo "Running setup.py with verbose output" && \
87
- python setup.py develop -v
88
 
89
  # Command to run your application
90
  CMD ["python", "app.py"]
 
1
+ # Use the NVIDIA CUDA runtime as a base image
2
+ FROM nvidia/cuda:11.3.1-cudnn8-devel-ubuntu20.04
3
 
4
  # Set environment variables
5
  ENV DEBIAN_FRONTEND=noninteractive
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  RUN useradd -m -u 1000 user
8
 
9
  USER user
 
19
  GRADIO_SHARE=False \
20
  SYSTEM=spaces
21
 
22
+ # Set the working directory to the user's home directory
23
+ WORKDIR $HOME/app
 
 
24
 
25
+ # Install system dependencies as root
26
+ USER root
27
+ RUN apt-get update && apt-get install -y --no-install-recommends \
28
+ git \
29
+ cmake \
30
+ build-essential \
31
+ libgl1-mesa-glx \
32
+ libglib2.0-0 \
33
+ ffmpeg \
34
+ python3.8 \
35
+ python3-pip \
36
+ python3.8-dev \
37
+ && rm -rf /var/lib/apt/lists/*
38
 
39
+ # Set Python 3.8 as the default python and pip versions
40
+ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
41
+ RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
42
 
43
+ USER user
44
  # Clone the repository (adjust the URL if needed)
45
+ RUN git clone --recursive https://github.com/jnjaby/KEEP.git .
46
 
47
+ # Copy the app.py script into the container
48
+ COPY app.py .
49
+ COPY requirements_HF.txt .
50
 
51
+ # Install Python dependencies from requirements.txt
52
+ RUN pip install --upgrade pip
53
+ RUN pip install -r requirements_HF.txt
54
+ RUN pip install gradio
55
+ RUN pip install cupy-wheel
56
 
57
+ USER root
58
+ # Install basicsr (assuming setup.py is in basicsr directory)
59
+ RUN python basicsr/setup.py develop
60
 
61
+ USER user
62
+ # Install additional Python packages
63
+ RUN pip install ffmpeg-python
64
+ RUN pip install dlib
 
 
 
65
 
66
+ # Set the environment variable to specify the GPU device
67
+ ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
68
+ ENV CUDA_VISIBLE_DEVICES=0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  # Command to run your application
71
  CMD ["python", "app.py"]