lolout1 commited on
Commit
e4bd7d6
·
1 Parent(s): 1814d30

added Rocky Linux support and new Dockerfile for cpu

Browse files
Files changed (1) hide show
  1. Dockerfile +71 -24
Dockerfile CHANGED
@@ -1,44 +1,91 @@
1
- FROM python:3.8-slim
 
 
2
 
3
  # Install system dependencies
4
- RUN apt-get update && apt-get install -y \
5
  git \
6
- build-essential \
 
 
 
 
 
 
 
7
  wget \
8
  curl \
 
 
 
 
 
 
 
 
 
9
  ffmpeg \
10
- libsm6 \
11
- libxext6 \
12
- libgl1-mesa-glx \
13
- && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
- # Create user (required by HF Spaces)
16
- RUN useradd -m -u 1000 user
17
 
18
- WORKDIR /app
 
19
 
20
- # Install Python packages
21
- COPY requirements.txt .
22
- RUN pip install --upgrade pip==22.3.1 && \
23
- pip install --no-cache-dir -r requirements.txt
24
 
25
- # Verify installations
26
- RUN python -c "import torch; print(f'PyTorch: {torch.__version__}, CPU: {not torch.cuda.is_available()}')"
27
- RUN python -c "import natten; print(f'NATTEN: {natten.__version__}')"
28
- RUN python -c "import detectron2; print(f'Detectron2: {detectron2.__version__}')"
 
 
29
 
30
- # Switch to user
31
  USER user
32
- ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
33
 
34
- # Copy application
35
- COPY --chown=user:user . /app
 
 
 
36
 
37
- # CPU optimizations
38
  ENV CUDA_VISIBLE_DEVICES=""
39
  ENV FORCE_CUDA="0"
40
  ENV OMP_NUM_THREADS=4
41
  ENV MKL_NUM_THREADS=4
 
42
 
43
  EXPOSE 7860
44
- CMD ["python", "gradio_app.py"]
 
1
+ FROM rockylinux:8.7
2
+
3
+ ENV DEBIAN_FRONTEND noninteractive
4
 
5
  # Install system dependencies
6
+ RUN yum update -y && yum install -y \
7
  git \
8
+ make \
9
+ gcc \
10
+ gcc-c++ \
11
+ openssl-devel \
12
+ zlib-devel \
13
+ bzip2-devel \
14
+ readline-devel \
15
+ sqlite-devel \
16
  wget \
17
  curl \
18
+ llvm \
19
+ ncurses-devel \
20
+ xz \
21
+ xz-devel \
22
+ tk-devel \
23
+ libxml2-devel \
24
+ libxmlsec1-devel \
25
+ libffi-devel \
26
+ liblzma-devel \
27
  ffmpeg \
28
+ libSM \
29
+ libXext \
30
+ libXrender \
31
+ cmake \
32
+ mesa-libGL \
33
+ python3-devel \
34
+ && yum clean all
35
+
36
+ # Create user
37
+ RUN useradd -ms /bin/bash user
38
+ USER user
39
+
40
+ ENV HOME=/home/user \
41
+ PATH=/home/user/.local/bin:$PATH
42
+
43
+ # Install pyenv
44
+ RUN curl https://pyenv.run | bash
45
+ ENV PATH=$HOME/.pyenv/shims:$HOME/.pyenv/bin:$PATH
46
+
47
+ # Install Python 3.8.15
48
+ RUN pyenv install 3.8.15 && \
49
+ pyenv global 3.8.15 && \
50
+ pyenv rehash && \
51
+ pip install --no-cache-dir --upgrade pip==22.3.1 setuptools wheel
52
+
53
+ ENV WORKDIR=/code
54
+ WORKDIR $WORKDIR
55
+
56
+ # Copy requirements
57
+ COPY --chown=user:user requirements.txt $WORKDIR/requirements.txt
58
 
59
+ # Install CPU-specific requirements with natten CPU wheel
60
+ RUN pip install --no-cache-dir --upgrade -r $WORKDIR/requirements.txt
61
 
62
+ # Verify natten installation
63
+ RUN python -c "import natten; print(f'NATTEN version: {natten.__version__}')"
64
 
65
+ # Copy application code
66
+ COPY --chown=user:user . .
 
 
67
 
68
+ # Set permissions
69
+ USER root
70
+ RUN chown -R user:user $HOME && \
71
+ chmod -R 755 $HOME && \
72
+ chown -R user:user $WORKDIR && \
73
+ chmod -R 755 $WORKDIR
74
 
 
75
  USER user
 
76
 
77
+ # Download example images
78
+ RUN mkdir -p examples && \
79
+ wget https://praeclarumjj3.github.io/files/ade20k.jpeg -P $WORKDIR/examples/ && \
80
+ wget https://praeclarumjj3.github.io/files/cityscapes.png -P $WORKDIR/examples/ && \
81
+ wget https://praeclarumjj3.github.io/files/coco.jpeg -P $WORKDIR/examples/
82
 
83
+ # CPU environment variables
84
  ENV CUDA_VISIBLE_DEVICES=""
85
  ENV FORCE_CUDA="0"
86
  ENV OMP_NUM_THREADS=4
87
  ENV MKL_NUM_THREADS=4
88
+ ENV PYTHONUNBUFFERED=1
89
 
90
  EXPOSE 7860
91
+ ENTRYPOINT ["python", "gradio_app.py"]