FlashCode-Lab commited on
Commit
f40dfdf
·
verified ·
1 Parent(s): ab77e7c

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -0
Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 使用 Ubuntu 作为基础镜像,这比直接用 Python 镜像更像一台完整的电脑
2
+ FROM ubuntu:22.04
3
+
4
+ # 设置环境变量,防止安装过程中的交互弹窗
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+
7
+ # 安装 Python, pip, curl 和基础工具
8
+ RUN apt-get update && apt-get install -y \
9
+ python3 \
10
+ python3-pip \
11
+ curl \
12
+ git \
13
+ sudo \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # 安装网页版 VS Code (code-server)
17
+ RUN curl -fsSL https://code-server.dev/install.sh | sh
18
+
19
+ # 创建一个非 root 用户(Hugging Face 安全要求)
20
+ RUN useradd -m -u 1000 user
21
+ USER user
22
+ ENV HOME=/home/user \
23
+ PATH=/home/user/.local/bin:$PATH
24
+
25
+ WORKDIR $HOME/app
26
+
27
+ # 暴露 Hugging Face 必须的 7860 端口
28
+ EXPOSE 7860
29
+
30
+ # 启动 code-server:不设密码,监听 7860 端口
31
+ CMD ["code-server", "--auth", "none", "--bind-addr", "0.0.0.0:7860", "."]