Spaces:
Running
Running
added Rocky Linux support and new Dockerfile for cpu
Browse files- Dockerfile +71 -24
Dockerfile
CHANGED
@@ -1,44 +1,91 @@
|
|
1 |
-
FROM
|
|
|
|
|
2 |
|
3 |
# Install system dependencies
|
4 |
-
RUN
|
5 |
git \
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
wget \
|
8 |
curl \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
ffmpeg \
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
#
|
16 |
-
RUN
|
17 |
|
18 |
-
|
|
|
19 |
|
20 |
-
#
|
21 |
-
COPY
|
22 |
-
RUN pip install --upgrade pip==22.3.1 && \
|
23 |
-
pip install --no-cache-dir -r requirements.txt
|
24 |
|
25 |
-
#
|
26 |
-
|
27 |
-
RUN
|
28 |
-
|
|
|
|
|
29 |
|
30 |
-
# Switch to user
|
31 |
USER user
|
32 |
-
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
|
33 |
|
34 |
-
#
|
35 |
-
|
|
|
|
|
|
|
36 |
|
37 |
-
# CPU
|
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 |
-
|
|
|
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"]
|