minhuu commited on
Commit
d2d468d
·
verified ·
1 Parent(s): 5ae9f77

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +55 -63
Dockerfile CHANGED
@@ -1,99 +1,91 @@
1
- FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04
2
-
3
  ENV DEBIAN_FRONTEND=noninteractive \
4
- TZ=Europe/Paris \
5
- HOME=/root
6
 
7
- # Remove any third-party apt sources and install basic utilities
 
8
  RUN rm -f /etc/apt/sources.list.d/*.list && \
9
  apt-get update && apt-get install -y --no-install-recommends \
10
- curl \
11
- ca-certificates \
12
- sudo \
13
- git \
14
- wget \
15
- procps \
16
- git-lfs \
17
- zip \
18
- aria2 \
19
- unzip \
20
- ffmpeg \
21
- htop \
22
- vim \
23
- nano \
24
- bzip2 \
25
- libx11-6 \
26
- build-essential \
27
- libsndfile-dev \
28
- software-properties-common \
29
  && rm -rf /var/lib/apt/lists/*
30
 
31
- # Install nvtop
32
  RUN add-apt-repository ppa:flexiondotorg/nvtop && \
33
  apt-get upgrade -y && \
34
  apt-get install -y --no-install-recommends nvtop
35
 
36
- # Install Node.js and configurable-http-proxy
37
- RUN curl -sL https://deb.nodesource.com/setup_21.x | bash - && \
38
  apt-get install -y nodejs && \
39
  npm install -g configurable-http-proxy
40
 
41
- # Set working directory
42
  WORKDIR /app
43
 
44
- # Install Conda in /root/miniconda and update PATH
 
 
 
 
 
 
 
 
 
 
45
  ENV CONDA_AUTO_UPDATE_CONDA=false \
46
- PATH=/root/miniconda/bin:$PATH
47
- RUN curl -sLo /tmp/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh && \
48
- chmod +x /tmp/miniconda.sh && \
49
- /tmp/miniconda.sh -b -p /root/miniconda && \
50
- rm /tmp/miniconda.sh && \
51
- conda clean -ya
52
 
53
  WORKDIR /app
54
 
55
- #######################################
56
- # Additional root-level operations
57
- #######################################
58
-
59
- # Install extra Debian packages (packages.txt must be provided)
60
  RUN --mount=target=/root/packages.txt,source=packages.txt \
61
  apt-get update && \
62
- xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends && \
63
- rm -rf /var/lib/apt/lists/*
64
 
65
- # Run startup script (if provided)
66
  RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
67
- bash /root/on_startup.sh
68
-
69
- # Create data directory
70
- RUN mkdir /data
71
 
72
- #######################################
73
- # Python packages and application files
74
- #######################################
75
 
76
- # Install Python packages from requirements.txt (ensure jupyterlab is included here or install explicitly)
77
  RUN --mount=target=requirements.txt,source=requirements.txt \
78
  pip install --no-cache-dir --upgrade -r requirements.txt
79
 
80
- # Explicitly install JupyterLab if not already in requirements.txt
81
- RUN pip install --no-cache-dir jupyterlab
82
-
83
- # Copy the current directory contents into /app
84
  COPY . /app
85
 
86
  RUN chmod +x start_server.sh
87
 
88
- # Overwrite Jupyter's login template if needed
89
- COPY login.html /root/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
90
 
91
  ENV PYTHONUNBUFFERED=1 \
92
- GRADIO_ALLOW_FLAGGING=never \
93
- GRADIO_NUM_PORTS=1 \
94
- GRADIO_SERVER_NAME=0.0.0.0 \
95
- GRADIO_THEME=huggingface \
96
- SYSTEM=spaces \
97
- SHELL=/bin/bash
98
 
99
  CMD ["./start_server.sh"]
 
 
 
1
  ENV DEBIAN_FRONTEND=noninteractive \
2
+ TZ=Europe/Paris
 
3
 
4
+ # Remove any third-party apt sources to avoid issues with expiring keys.
5
+ # Install some basic utilities
6
  RUN rm -f /etc/apt/sources.list.d/*.list && \
7
  apt-get update && apt-get install -y --no-install-recommends \
8
+ curl \
9
+ ca-certificates \
10
+ sudo \
11
+ git \
12
+ wget \
13
+ procps \
14
+ git-lfs \
15
+ zip \
16
+ aria2 \
17
+ unzip \
18
+ ffmpeg \
19
+ htop \
20
+ vim \
21
+ nano \
22
+ bzip2 \
23
+ libx11-6 \
24
+ build-essential \
25
+ libsndfile-dev \
26
+ software-properties-common \
27
  && rm -rf /var/lib/apt/lists/*
28
 
 
29
  RUN add-apt-repository ppa:flexiondotorg/nvtop && \
30
  apt-get upgrade -y && \
31
  apt-get install -y --no-install-recommends nvtop
32
 
33
+ RUN curl -sL https://deb.nodesource.com/setup_21.x | bash - && \
 
34
  apt-get install -y nodejs && \
35
  npm install -g configurable-http-proxy
36
 
37
+ # Create a working directory
38
  WORKDIR /app
39
 
40
+ # Create a user account but continue using root
41
+ RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
42
+ && chown -R user:user /app
43
+ RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
44
+
45
+ # Create home directories that will be accessible
46
+ ENV HOME=/home/user
47
+ RUN mkdir -p $HOME/.cache $HOME/.config \
48
+ && chmod -R 777 $HOME
49
+
50
+ # Set up the Conda environment (as root)
51
  ENV CONDA_AUTO_UPDATE_CONDA=false \
52
+ PATH=/opt/conda/bin:$PATH
53
+ RUN curl -sLo /tmp/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
54
+ && chmod +x /tmp/miniconda.sh \
55
+ && /tmp/miniconda.sh -b -p /opt/conda \
56
+ && rm /tmp/miniconda.sh \
57
+ && conda clean -ya
58
 
59
  WORKDIR /app
60
 
61
+ # User Debian packages
 
 
 
 
62
  RUN --mount=target=/root/packages.txt,source=packages.txt \
63
  apt-get update && \
64
+ xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
65
+ && rm -rf /var/lib/apt/lists/*
66
 
 
67
  RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
68
+ bash /root/on_startup.sh
 
 
 
69
 
70
+ RUN mkdir -p /data && chown user:user /data
 
 
71
 
72
+ # Python packages
73
  RUN --mount=target=requirements.txt,source=requirements.txt \
74
  pip install --no-cache-dir --upgrade -r requirements.txt
75
 
76
+ # Copy the current directory contents into the container
 
 
 
77
  COPY . /app
78
 
79
  RUN chmod +x start_server.sh
80
 
81
+ COPY login.html /opt/conda/lib/python3.9/site-packages/jupyter_server/templates/login.html
 
82
 
83
  ENV PYTHONUNBUFFERED=1 \
84
+ GRADIO_ALLOW_FLAGGING=never \
85
+ GRADIO_NUM_PORTS=1 \
86
+ GRADIO_SERVER_NAME=0.0.0.0 \
87
+ GRADIO_THEME=huggingface \
88
+ SYSTEM=spaces \
89
+ SHELL=/bin/bash
90
 
91
  CMD ["./start_server.sh"]