code / Dockerfile
hybtel's picture
Update Dockerfile
0a4b087 verified
raw
history blame contribute delete
760 Bytes
# 使用官方 Code Server 镜像作为基础
FROM codercom/code-server:latest
# 设置工作目录
WORKDIR /home/coder
# 以 root 用户安装必要的依赖(在切换用户之前)
USER root
# apt-get install python3 python3-venv python3-pip
RUN apt-get update && apt-get install -y \
curl python3 python3-venv python3-pip python3-notebook \
&& rm -rf /var/lib/apt/lists/*
# RUN pip install notebook
# 切换到非 root 用户(code-server 默认使用 coder 用户)
USER coder
# 设置环境变量,例如密码
ENV PASSWORD="tensoft7396"
# 设置登录密码
EXPOSE 7860
# Code Server 默认运行在 8080 端口
# 确保以非 root 用户启动 Code Server
ENTRYPOINT ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "none"]