File size: 1,728 Bytes
c373af3 0acdbb9 f76ba25 c20a15c d4b966e d2ad03f 3e19bbe 3ce4482 723e756 c74d948 7f15058 c20a15c 7f15058 c373af3 b9495b5 fe71906 0acdbb9 3ce4482 b9495b5 773951f c20a15c 723e756 b4efd6f 74c7bbc 2f987a1 254178e 2f987a1 |
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 |
FROM ubuntu:20.04
RUN useradd -m -s /bin/bash -u 1000 leo && \
echo "leo:zxcvbnm" | chpasswd && \
apt update && \
apt install -y curl bash-completion wget vim net-tools lsof nginx htop && \
# usermod -aG sudo leo && \
# echo "leo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
chown -R leo:leo /bin /sbin/ /media /mnt /opt /usr /var /tmp /run /home
RUN curl -fsSL https://raw.githubusercontent.com/cdr/code-server/main/install.sh | sh
# 引入设置中创建的secret变量
RUN --mount=type=secret,id=password,mode=0444,required=true cat /run/secrets/password > /run/passwd
# RUN ls /.config/ && cat /.config/code-server/config.yaml
COPY ./config.yaml /home/leo/.config/code-server/config.yaml
# RUN sed -i 's/psaaword/`cat /run/passwd`/' /home/leo/.config/code-server/config.yaml
RUN echo "password: $(cat /run/passwd)" >> /home/leo/.config/code-server/config.yaml
USER leo
ENV HOME=/home/leo \
PATH=/home/leo/.local/bin:$PATH
WORKDIR $HOME
# WORKDIR /workspace
EXPOSE 8080
# RUN sudo curl -fsSL https://raw.githubusercontent.com/cdr/code-server/main/install.sh | sh
# 设置code-server启动脚本
#RUN echo "#!/bin/bash \n\
# code-server --bind-addr 0.0.0.0:8080 --auth none" > /root/startup.sh
# RUN chmod +x /root/startup.sh
# RUN mkdir /.config && chmod -R 777 /.config && mkdir /.local && chmod -R 777 /.local
CMD ["code-server", "--bind-addr", "0.0.0.0:8080", "--config", "/home/leo/.config/code-server/config.yaml"]
# CMD code-server --help
# code-server项目仓库:https://github.com/cdr/code-server
# hugging face docker 权限问题和环境变量的引用需了解:https://huggingface.co/docs/hub/spaces-sdks-docker
# codeserver安装使用示例:https://betheme.net/houduan/3278.html?action=onClick |