File size: 647 Bytes
706422f
63b7863
 
706422f
63b7863
 
706422f
63b7863
 
 
 
 
706422f
63b7863
 
706422f
17bea3e
63b7863
706422f
63b7863
 
706422f
63b7863
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 使用官方 Code Server 镜像作为基础
FROM codercom/code-server:latest

# 设置工作目录
WORKDIR /home/coder

# 以 root 用户安装必要的依赖
USER root
RUN apt-get update && apt-get install -y \
    curl python3 python3-venv python3-pip python3-notebook \
    && rm -rf /var/lib/apt/lists/*

# 切换到非 root 用户(code-server 默认使用 coder 用户)
USER coder

# 设置登录密码
ENV PASSWORD="password"

# 暴露端口(code-server 默认端口为 8080,这里改为 7860)
EXPOSE 7860

# 启动 Code Server 并启用密码认证
ENTRYPOINT ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "password"]