FROM ubuntu:20.04 | |
# RUN echo "leo:zxcvbnm" | chpasswd | |
RUN apt update && apt install -y curl | |
# WORKDIR /workspace | |
EXPOSE 8080 | |
RUN 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 -p /.config && chmod -R 777 /.config | |
# 引入设置中创建的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 | |
ENV CODE_SERVER_PASSWORD="zxcvbnm" | |
CMD ["code-server", "--bind-addr", "0.0.0.0:8080", "--auth", "none"] | |
# 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 |