簡體   English   中英

嘗試 dockerize Django 應用程序,Docker 找不到 ft2build.h

[英]Trying to dockerize Django app, Docker cannot find ft2build.h

我是 Docker 的新手,我正在嘗試對 Django 應用程序進行 docker 化,但是當我運行docker build -t sometag. 我收到以下錯誤:

#9 23.05   Preparing metadata (setup.py): started
#9 23.32   Preparing metadata (setup.py): finished with status 'error'
#9 23.33   error: subprocess-exited-with-error
#9 23.33
#9 23.33   × python setup.py egg_info did not run successfully.
#9 23.33   │ exit code: 1
#9 23.33   ╰─> [10 lines of output]
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: ================================================
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: Attempting build of _rl_accel
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: extensions from 'src/rl_addons/rl_accel'
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: ================================================
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: ===================================================
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: Attempting build of _renderPM
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: extensions from 'src/rl_addons/renderPM'
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: ===================================================
#9 23.33       ##### setup-python-3.10.8-linux-x86_64: will use package libart 2.3.21
#9 23.33       !!!!! cannot find ft2build.h
#9 23.33       [end of output]
#9 23.33
#9 23.33   note: This error originates from a subprocess, and is likely not a problem with pip.
#9 23.33 error: metadata-generation-failed
#9 23.33
#9 23.33 × Encountered error while generating package metadata.
#9 23.33 ╰─> See above for output.
#9 23.33
#9 23.33 note: This is an issue with the package mentioned above, not pip.
#9 23.33 hint: See above for details.
------
executor failed running [/bin/sh -c pip install -r requirements.txt]: exit code: 1

我不確定它是否與 ft2build.h 有關。我是不是在我的 dockerfile 上遺漏了什么?

這是我的requirements.txt:

arabic-reshaper==2.1.3
asn1crypto==1.5.1
attrs==20.3.0
azure-core==1.23.1
azure-storage-blob==12.11.0
certifi==2021.10.8
cffi==1.15.0
charset-normalizer==2.0.12
click==8.1.2
colorama==0.4.4
cryptography==36.0.2
cssselect2==0.5.0
distlib==0.3.5
Django==4.0.3
django-crispy-forms==1.14.0
django-storages==1.12.3
djangorestframework==3.14.0
filelock==3.8.0
future==0.18.2
html5lib==1.1
idna==3.3
isodate==0.6.1
jellyfish==0.9.0
lib50==3.0.4
lxml==4.8.0
markdown2==2.4.2
msrest==0.6.21
oauthlib==3.2.0
oscrypto==1.3.0
pexpect==4.8.0
Pillow==9.1.0
platformdirs==2.5.2
psycopg2-binary==2.9.3
ptyprocess==0.7.0
pycparser==2.21
pyHanko==0.12.1
pyhanko-certvalidator==0.19.5
PyPDF2==1.27.3
PyPDF3==1.0.6
python-bidi==0.4.2
pytz==2022.1
PyYAML==5.4.1
qrcode==7.3.1
reportlab==3.6.9
requests==2.27.1
requests-oauthlib==1.3.1
six==1.16.0
submit50==3.1.1
svglib==1.2.1
termcolor==1.1.0
tinycss2==1.1.1
tk==0.1.0
tqdm==4.64.0
typing_extensions==4.1.1
tzdata==2022.1
tzlocal==4.2
uritools==4.0.0
urllib3==1.26.9
virtualenv==20.16.3
webencodings==0.5.1
whitenoise==6.0.0
xhtml2pdf==0.2.7

注意:我不得不刪除 dockerfile,因為 Stackoverflow 不允許我發布這么多代碼,但我正在運行這個RUN apk update \&& apk add --no-cache gcc musl-dev postgresql-dev python3-dev libffi-dev \&& pip install --upgrade pip

我不確定它是否與 ft2build.h 有關。我是不是在我的 dockerfile 上遺漏了什么?

解決ft2build.h的錯誤問題。 在編譯過程中,需要安裝freetype庫

我假設您使用的是最新版本的 Alpine,我可以看到您可以毫無問題地安裝 pip 個軟件包。

因此,缺少的部分應該是要安裝的 freetype-dev package。

RUN apk update \ 
 && apk add --no-cache gcc musl-dev postgresql-dev python3-dev libffi-dev freetype-dev\

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM