File size: 1,540 Bytes
3d1994d
5d9e170
3d1994d
 
 
 
 
 
 
 
 
 
f1bb342
780e6b8
3d1994d
 
 
 
a952a3b
3d1994d
 
ee37b67
3d1994d
 
ee37b67
3d1994d
 
ee37b67
a0fb3f4
3d1994d
4bc42e1
38fa667
 
 
 
0c2dc15
3d1994d
 
a14da40
0c2dc15
 
3d1994d
0c2dc15
 
 
 
 
3d1994d
ee37b67
3d1994d
 
00d812c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 使用 Ubuntu 22.04 作为基础镜像
FROM ich777/microsoft-edge

# 设置环境变量以避免交互式提示
ENV DEBIAN_FRONTEND=noninteractive

# 更新包列表并安装必要的依赖
RUN apt-get update && apt-get install -y \
    wget \
    gnupg2 \
    software-properties-common \
    && apt-get update \
    && apt-get install -y python3.11 python3.11-venv \
    && apt-get install -y python3-pip \
    && apt-get clean

# 创建 python 的符号链接
RUN ln -s /usr/bin/python3.11 /usr/bin/python


# # 创建非特权用户
RUN useradd -m -s /bin/bash appuser

# 设置工作目录
WORKDIR /opt/scripts

# 将当前目录内容复制到容器的 /app 中
COPY . /opt/scripts
RUN chmod +x /opt/scripts/start.sh
# 更改目录和文件的所有者
RUN chown -R appuser:appuser /opt/scripts
# 打印 /opt/scripts/start.sh 文件的内容
RUN cat /opt/scripts/start.sh

# 删除 /opt/scripts/start.sh 文件
# RUN rm /opt/scripts/start.sh

# 安装任何需要的包,使用 --ignore-installed 选项
RUN pip install --ignore-installed --break-system-packages -r requirements.txt
# 确保 /opt/scripts/start.sh 脚本具有执行权限
RUN mkdir -p /opt/scripts && chmod +x /opt/scripts/start.sh

# 以 root 用户运行
USER root

# 确保 /var/lib/apt/lists/partial 目录存在并具有正确的权限
RUN mkdir -p /var/lib/apt/lists/partial && chmod 755 /var/lib/apt/lists/partial
# 切换到非特权用户
USER appuser

# 设置默认命令(可根据需要修改)
CMD ["python3.11", "main.py && /opt/scripts/start.sh"]