atonyxu commited on
Commit
0e95018
·
1 Parent(s): cc660af
Files changed (2) hide show
  1. 1Dockerfile +110 -0
  2. Dockerfile +8 -107
1Dockerfile ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive \
4
+ TZ=Asia/Shanghai
5
+
6
+ # Remove any third-party apt sources to avoid issues with expiring keys.
7
+ # Install some 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
+ aria2 \
16
+ axel \
17
+ procps \
18
+ git-lfs \
19
+ zip \
20
+ unzip \
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
+ RUN add-apt-repository ppa:flexiondotorg/nvtop && \
32
+ apt-get upgrade -y && \
33
+ apt-get install -y --no-install-recommends nvtop
34
+
35
+ RUN curl -sL https://deb.nodesource.com/setup_21.x | bash - && \
36
+ apt-get install -y nodejs && \
37
+ npm install -g configurable-http-proxy
38
+
39
+ # Create a working directory
40
+ WORKDIR /app
41
+
42
+ # Create a non-root user and switch to it
43
+ RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
44
+ && chown -R user:user /app
45
+ RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
46
+ USER user
47
+
48
+ # All users can use /home/user as their home directory
49
+ ENV HOME=/home/user
50
+ RUN mkdir $HOME/.cache $HOME/.config \
51
+ && chmod -R 777 $HOME
52
+
53
+ # Set up the Conda environment
54
+ ENV CONDA_AUTO_UPDATE_CONDA=false \
55
+ PATH=$HOME/miniconda/bin:$PATH
56
+ RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
57
+ && chmod +x ~/miniconda.sh \
58
+ && ~/miniconda.sh -b -p ~/miniconda \
59
+ && rm ~/miniconda.sh \
60
+ && conda clean -ya
61
+
62
+ WORKDIR $HOME/app
63
+
64
+ #######################################
65
+ # Start root user section
66
+ #######################################
67
+
68
+ USER root
69
+
70
+ # User Debian packages
71
+ ## Security warning : Potential user code executed as root (build time)
72
+ RUN --mount=target=/root/packages.txt,source=packages.txt \
73
+ apt-get update && \
74
+ xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
75
+ && rm -rf /var/lib/apt/lists/*
76
+
77
+ RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
78
+ bash /root/on_startup.sh
79
+
80
+ RUN mkdir /data && chown user:user /data
81
+
82
+ #######################################
83
+ # End root user section
84
+ #######################################
85
+
86
+ USER user
87
+
88
+ # Python packages
89
+ RUN --mount=target=requirements.txt,source=requirements.txt \
90
+ pip install --no-cache-dir --upgrade -r requirements.txt && \
91
+ pip install glances modelscope huggingface_hub jupyterlab-language-pack-zh-CN
92
+
93
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
94
+ COPY --chown=user . $HOME/app
95
+
96
+ RUN chmod +x start_server.sh
97
+
98
+ COPY --chown=user login.html /home/user/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
99
+
100
+ ENV PYTHONUNBUFFERED=1 \
101
+ GRADIO_ALLOW_FLAGGING=never \
102
+ GRADIO_NUM_PORTS=1 \
103
+ GRADIO_SERVER_NAME=0.0.0.0 \
104
+ GRADIO_THEME=huggingface \
105
+ SYSTEM=spaces \
106
+ SHELL=/bin/bash
107
+
108
+ RUN curl -fsSL https://code-server.dev/install.sh | sh
109
+ CMD ["/home/user/app/start_server.sh"]
110
+ WORKDIR /data
Dockerfile CHANGED
@@ -1,110 +1,11 @@
1
- FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04
 
2
 
3
- ENV DEBIAN_FRONTEND=noninteractive \
4
- TZ=Asia/Shanghai
5
 
6
- # Remove any third-party apt sources to avoid issues with expiring keys.
7
- # Install some 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
- aria2 \
16
- axel \
17
- procps \
18
- git-lfs \
19
- zip \
20
- unzip \
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
- RUN add-apt-repository ppa:flexiondotorg/nvtop && \
32
- apt-get upgrade -y && \
33
- apt-get install -y --no-install-recommends nvtop
34
-
35
- RUN curl -sL https://deb.nodesource.com/setup_21.x | bash - && \
36
- apt-get install -y nodejs && \
37
- npm install -g configurable-http-proxy
38
-
39
- # Create a working directory
40
- WORKDIR /app
41
-
42
- # Create a non-root user and switch to it
43
- RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
44
- && chown -R user:user /app
45
- RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
46
- USER user
47
-
48
- # All users can use /home/user as their home directory
49
- ENV HOME=/home/user
50
- RUN mkdir $HOME/.cache $HOME/.config \
51
- && chmod -R 777 $HOME
52
-
53
- # Set up the Conda environment
54
- ENV CONDA_AUTO_UPDATE_CONDA=false \
55
- PATH=$HOME/miniconda/bin:$PATH
56
- RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
57
- && chmod +x ~/miniconda.sh \
58
- && ~/miniconda.sh -b -p ~/miniconda \
59
- && rm ~/miniconda.sh \
60
- && conda clean -ya
61
-
62
- WORKDIR $HOME/app
63
-
64
- #######################################
65
- # Start root user section
66
- #######################################
67
-
68
- USER root
69
-
70
- # User Debian packages
71
- ## Security warning : Potential user code executed as root (build time)
72
- RUN --mount=target=/root/packages.txt,source=packages.txt \
73
- apt-get update && \
74
- xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
75
- && rm -rf /var/lib/apt/lists/*
76
-
77
- RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
78
- bash /root/on_startup.sh
79
-
80
- RUN mkdir /data && chown user:user /data
81
-
82
- #######################################
83
- # End root user section
84
- #######################################
85
-
86
- USER user
87
-
88
- # Python packages
89
- RUN --mount=target=requirements.txt,source=requirements.txt \
90
- pip install --no-cache-dir --upgrade -r requirements.txt && \
91
- pip install glances modelscope huggingface_hub jupyterlab-language-pack-zh-CN
92
-
93
- # Copy the current directory contents into the container at $HOME/app setting the owner to the user
94
- COPY --chown=user . $HOME/app
95
-
96
- RUN chmod +x start_server.sh
97
-
98
- COPY --chown=user login.html /home/user/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
99
-
100
- ENV PYTHONUNBUFFERED=1 \
101
- GRADIO_ALLOW_FLAGGING=never \
102
- GRADIO_NUM_PORTS=1 \
103
- GRADIO_SERVER_NAME=0.0.0.0 \
104
- GRADIO_THEME=huggingface \
105
- SYSTEM=spaces \
106
- SHELL=/bin/bash
107
-
108
- RUN curl -fsSL https://code-server.dev/install.sh | sh
109
- CMD ["/home/user/app/start_server.sh"]
110
- WORKDIR /data
 
1
+ # Use an official Node.js runtime as a parent image
2
+ FROM codercom/code-server:latest
3
 
4
+ # Set the environment variables for code-server
5
+ ENV PASSWORD=123456
6
 
7
+ # Expose the port on which code-server will run
8
+ EXPOSE 8080
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
+ # Run code-server
11
+ CMD ["code-server", "--bind-addr", "0.0.0.0:8080", "--auth", "password"]