Dockerfile.codeserver_ubuntu 2.93 KB
Newer Older
chenpangpang's avatar
chenpangpang committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#请确保网络畅通,插件可自行安装
#请将以下FROM后的镜像修改为需要添加codeserver的原始镜像
FROM nvidia/cuda:11.3.1-cudnn8-runtime-ubuntu20.04
LABEL module="vscode"
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Shanghai
ENV SHELL=/bin/bash \
    LC_ALL=en_US.UTF-8 \
    LANG=en_US.UTF-8 \
    LANGUAGE=en_US.UTF-8
ARG SOURCES="-i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn"
SHELL ["/bin/bash","-c"]
USER root
WORKDIR /tmp

# 设置软链接python pip
RUN ln -sf /usr/bin/pip3 /usr/bin/pip \
    && ln -sf /usr/bin/python3 /usr/bin/python

COPY ./python-requirements.txt /tmp/

COPY ./code-server_4.7.0_amd64.deb ./
RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak; \
version_codename=$(cat /etc/os-release | grep -i 'VERSION_CODENAME' | awk -F= '{print $2}') \
&& echo -e "deb http://mirrors.aliyun.com/ubuntu/ ${version_codename} main restricted universe multiverse \n\
deb http://mirrors.aliyun.com/ubuntu/ ${version_codename}-security main restricted universe multiverse\n\
deb http://mirrors.aliyun.com/ubuntu/ ${version_codename}-updates main restricted universe multiverse\n\
deb http://mirrors.aliyun.com/ubuntu/ ${version_codename}-proposed main restricted universe multiverse\n\
deb http://mirrors.aliyun.com/ubuntu/ ${version_codename}-backports main restricted universe multiverse\n\
deb-src http://mirrors.aliyun.com/ubuntu/ ${version_codename} main restricted universe multiverse\n\
deb-src http://mirrors.aliyun.com/ubuntu/ ${version_codename}-security main restricted universe multiverse\n\
deb-src http://mirrors.aliyun.com/ubuntu/ ${version_codename}-updates main restricted universe multiverse\n\
deb-src http://mirrors.aliyun.com/ubuntu/ ${version_codename}-proposed main restricted universe multiverse\n\
deb-src http://mirrors.aliyun.com/ubuntu/ ${version_codename}-backports main restricted universe multiverse" > /etc/apt/sources.list \
    && apt-get update -y \
    && apt-get install --no-install-recommends -y \
    openssl \
    libssl-dev \
    net-tools \
    locales \
    wget \
    git \
    sudo \
    openssh-client \
    openssh-server \
    python3.8 \
    python3-pip \
    && locale-gen en_US.UTF-8 \
    && dpkg -i code-server_4.7.0_amd64.deb \
    && pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple \
    && pip install -r /tmp/python-requirements.txt ${SOURCES} \
    && cp /root/.config/pip/pip.conf /etc/pip.conf \
    && mkdir -p /var/run/sshd \
    && ssh-keygen  -A \
    && sed -i "s/#UseDNS .*/UseDNS no/" /etc/ssh/sshd_config

WORKDIR /

RUN pip3 install torch==1.10.0 torchvision==0.11.0 torchaudio==0.10.0 --index-url https://download.pytorch.org/whl/cu113 && \
    ([ ! -d /root/.cache/pip ] || rm -r /root/.cache/pip)

### 添加HF的镜像变量
#ENV HF_ENDPOINT=https://hf-mirror.com
#RUN echo 'export HF_ENDPOINT=https://hf-mirror.com' >> /etc/bash.bashrc && \
#    echo 'export HF_ENDPOINT=https://hf-mirror.com' >> ~/.bashrc





EXPOSE 8080