File size: 1,487 Bytes
601fac8
 
eea8147
4125ecd
601fac8
454b7dc
 
d24f3fe
47471cd
601fac8
55fcf06
601fac8
5f0c24c
 
601fac8
 
5f0c24c
601fac8
5f0c24c
601fac8
0c59880
 
00fe36b
0c59880
5f0c24c
 
601fac8
5f0c24c
601fac8
 
0c59880
 
 
 
 
 
 
 
601fac8
 
 
0c59880
74f7d1f
 
601fac8
 
0c59880
601fac8
 
0c59880
601fac8
 
0c59880
601fac8
 
0c59880
601fac8
d914b95
601fac8
 
0c59880
601fac8
0c59880
 
387fc65
601fac8
78fa7f6
601fac8
 
 
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
FROM python:3.9
RUN apt update && apt install -y libgl1-mesa-glx 


##安装imagemagic ,linux使用convert路径即可
RUN apt install -y imagemagick
ENV IMAGEMAGICK_BINARY=/usr/bin/convert
#这条命令成效显著 RUN sed -i 's/none/read,write/g' /etc/ImageMagick-6/policy.xml   就是这个原因说unrecogize format
RUN sed -i 's/none/read,write/g' /etc/ImageMagick-6/policy.xml 
##安装imagemagic

RUN pip install -U pip


COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .

# #目前的写法是成功找到了magick文件并且python可以执行,就是magick文件没有找对 -因为找convert才对
# # 修改 magick 文件的执行权限
# RUN chmod +x ./magick

# ENV IMAGEMAGICK_BINARY=./magick


EXPOSE 7860

#server.py
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]








# #现成magick docker镜像测试
# #这个dpokidov/imagemagick 含有magick命令
# FROM dpokidov/imagemagick 



# # 安装 Python 3.9
# RUN apt-get update && apt-get install -y python3.9  libgl1-mesa-glx libglib2.0-dev

# # 设置 Python 3.9 作为默认 Python 版本
# RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1

# # 安装 pip
# RUN apt-get install -y python3-pip

# # 升级 pip
# RUN python3.9 -m pip install --upgrade pip

# RUN pip install -U pip

# COPY requirements.txt .
# RUN pip install -r requirements.txt

# COPY . .



# EXPOSE 7860

# #RUN python3 server.py
# #结束周期
# CMD python3 server.py