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

# 使用debian Linux作为基础镜像
#FROM python:3.10.14-bullseye
FROM registry.cn-hangzhou.aliyuncs.com/lyfch/oslock:python3.10.14

# # 备份原有的sources.list文件
RUN rm -f /etc/apt/sources.list
RUN rm -fr /etc/apt/sources.list.d/

# 添加软件源
RUN echo \"deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main \" >> /etc/apt/sources.list
RUN echo \"deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main\" >> /etc/apt/sources.list
RUN echo \"deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main\" >> /etc/apt/sources.list
RUN echo \"deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main\" >> /etc/apt/sources.list
RUN echo \"deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main \" >> /etc/apt/sources.list
RUN echo \"deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main \" >> /etc/apt/sources.list
RUN echo \"deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main \" >> /etc/apt/sources.list
RUN echo \"deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main \" >> /etc/apt/sources.list
RUN cat /etc/apt/sources.list

RUN apt-get clean
RUN apt-get update
RUN apt-get install net-tools && apt-get install git dos2unix nano

# git
# RUN git config --global user.name \"oslock\"

# 设置工作目录
ENV wkdir /var/wwww
WORKDIR /var/wwww/
COPY requirements.txt start.sh respository /var/wwww/

RUN dos2unix start.sh
RUN dos2unix requirements.txt
RUN dos2unix respository


# 创建一个虚拟环境并安装依赖
RUN python3 -m venv /venv
RUN /venv/bin/pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
RUN /venv/bin/pip install --upgrade pip
RUN /venv/bin/pip install -r requirements.txt
RUN /venv/bin/pip install gunicorn
RUN /venv/bin/pip install pymysql


#对外暴露端口
EXPOSE 8080
RUN chmod +x start.sh
CMD [\"/var/wwww/start.sh\"]