BG5 commited on
Commit
3d1994d
·
verified ·
1 Parent(s): f2500ab

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +51 -0
Dockerfile ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 使用 Ubuntu 22.04 作为基础镜像
2
+ FROM browsers/edge
3
+
4
+ # 设置环境变量以避免交互式提示
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+
7
+ # 更新包列表并安装必要的依赖
8
+ RUN apt-get update && apt-get install -y \
9
+ wget \
10
+ gnupg2 \
11
+ software-properties-common \
12
+ && add-apt-repository ppa:deadsnakes/ppa \
13
+ && apt-get update \
14
+ && apt-get install -y python3.11 python3.11-distutils \
15
+ && apt-get clean
16
+
17
+ # 创建 python 的符号链接
18
+ RUN ln -s /usr/bin/python3.11 /usr/bin/python
19
+
20
+ # 安装 pip
21
+ RUN wget https://bootstrap.pypa.io/get-pip.py && python3.11 get-pip.py && rm get-pip.py
22
+
23
+ # # 添加 Microsoft 的 GPG 密钥和软件源
24
+ # RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
25
+ # && add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/edge/ stable main" \
26
+ # && apt-get update
27
+
28
+ # # 安装 Microsoft Edge 浏览器
29
+ # RUN apt-get install -y microsoft-edge-stable \
30
+ # && apt-get clean
31
+
32
+ # # 创建非特权用户
33
+ RUN useradd -m -s /bin/bash appuser
34
+
35
+ # 设置工作目录
36
+ WORKDIR /app
37
+
38
+ # 将当前目录内容复制到容器的 /app 中
39
+ COPY . /app
40
+
41
+ # 更改目录和文件的所有者
42
+ RUN chown -R appuser:appuser /app
43
+
44
+ # 安装任何需要的包,使用 --ignore-installed 选项
45
+ RUN pip install --no-cache-dir --ignore-installed -r requirements.txt
46
+
47
+ # 切换到非特权用户
48
+ USER appuser
49
+
50
+ # 设置默认命令(可根据需要修改)
51
+ CMD ["python3.11", "main.py"]