File size: 654 Bytes
1e465f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 使用官方 code-server 镜像作为基础
FROM codercom/code-server:latest

# (可选)设置工作目录
WORKDIR /home/coder

# (可选)安装额外依赖或工具,例如 Python
# RUN apt-get update && apt-get install -y python3 python3-pip

# 暴露端口,Hugging Face Spaces 默认使用 7860
EXPOSE 7860

# 设置环境变量,包括访问密码和绑定地址
ENV PASSWORD=test123456
# 将默认端口从 8080 改为 7860
ENV PORT=7860

# 启动 code-server,并配置参数
# --auth password 表示使用密码验证
# --host 0.0.0.0 表示允许外部访问
CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "password"]