atonyxu commited on
Commit
338df9f
·
1 Parent(s): 0e95018
Files changed (1) hide show
  1. Dockerfile +99 -0
Dockerfile CHANGED
@@ -4,6 +4,105 @@ FROM codercom/code-server:latest
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
 
 
4
  # Set the environment variables for code-server
5
  ENV PASSWORD=123456
6
 
7
+ ENV DEBIAN_FRONTEND=noninteractive \
8
+ TZ=Asia/Shanghai
9
+
10
+ # Remove any third-party apt sources to avoid issues with expiring keys.
11
+ # Install some basic utilities
12
+ RUN rm -f /etc/apt/sources.list.d/*.list && \
13
+ apt-get update && apt-get install -y --no-install-recommends \
14
+ curl \
15
+ ca-certificates \
16
+ sudo \
17
+ git \
18
+ wget \
19
+ aria2 \
20
+ axel \
21
+ procps \
22
+ git-lfs \
23
+ zip \
24
+ unzip \
25
+ htop \
26
+ vim \
27
+ nano \
28
+ bzip2 \
29
+ libx11-6 \
30
+ build-essential \
31
+ libsndfile-dev \
32
+ software-properties-common \
33
+ && rm -rf /var/lib/apt/lists/*
34
+
35
+ RUN add-apt-repository ppa:flexiondotorg/nvtop && \
36
+ apt-get upgrade -y && \
37
+ apt-get install -y --no-install-recommends nvtop
38
+
39
+ RUN curl -sL https://deb.nodesource.com/setup_21.x | bash - && \
40
+ apt-get install -y nodejs && \
41
+ npm install -g configurable-http-proxy
42
+
43
+ # Create a working directory
44
+ WORKDIR /app
45
+
46
+ # All users can use /home/coder as their home directory
47
+ ENV HOME=/home/coder
48
+ RUN mkdir $HOME/.cache $HOME/.config \
49
+ && chmod -R 777 $HOME
50
+
51
+ # Set up the Conda environment
52
+ ENV CONDA_AUTO_UPDATE_CONDA=false \
53
+ PATH=$HOME/miniconda/bin:$PATH
54
+ RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
55
+ && chmod +x ~/miniconda.sh \
56
+ && ~/miniconda.sh -b -p ~/miniconda \
57
+ && rm ~/miniconda.sh \
58
+ && conda clean -ya
59
+
60
+ WORKDIR $HOME/app
61
+
62
+ #######################################
63
+ # Start root user section
64
+ #######################################
65
+
66
+ USER root
67
+
68
+ # User Debian packages
69
+ ## Security warning : Potential user code executed as root (build time)
70
+ RUN --mount=target=/root/packages.txt,source=packages.txt \
71
+ apt-get update && \
72
+ xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
73
+ && rm -rf /var/lib/apt/lists/*
74
+
75
+ RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
76
+ bash /root/on_startup.sh
77
+
78
+ RUN mkdir /data && chown coder:coder /data
79
+
80
+ #######################################
81
+ # End root user section
82
+ #######################################
83
+
84
+ USER coder
85
+
86
+ # Python packages
87
+ RUN --mount=target=requirements.txt,source=requirements.txt \
88
+ pip install --no-cache-dir --upgrade -r requirements.txt && \
89
+ pip install glances modelscope huggingface_hub jupyterlab-language-pack-zh-CN
90
+
91
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
92
+ COPY --chown=coder . $HOME/app
93
+
94
+ RUN chmod +x start_server.sh
95
+
96
+ COPY --chown=coder login.html /home/coder/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
97
+
98
+ ENV PYTHONUNBUFFERED=1 \
99
+ GRADIO_ALLOW_FLAGGING=never \
100
+ GRADIO_NUM_PORTS=1 \
101
+ GRADIO_SERVER_NAME=0.0.0.0 \
102
+ GRADIO_THEME=huggingface \
103
+ SYSTEM=spaces \
104
+ SHELL=/bin/bash
105
+
106
  # Expose the port on which code-server will run
107
  EXPOSE 8080
108