我正在 Gitlab 实例上设置 CI/CD 管道,用于测试和冻结/编译 Python 代码。二进制可执行文件将使用 Pyinstaller 生成。我希望我的管道能够为 Linux/Windows(64 位)构建可执行文件。到目前为止,所有阶段都正常工作,除了冻结 Windows 的代码。我正在尝试使用 wine 在 Docker 容器中安装 64 位 python。虽然我明确下载了 64 位 Windows 可执行文件,但 wine 一直抱怨缺少 32 位支持(我明确不想要/不需要)。
谁能告诉我是什么导致了这个错误/行为以及最终如何修复它?
系统信息
# uname -a
Linux underdesk 5.15.0-25-generic #25-Ubuntu SMP Wed Mar 30 15:54:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Dockerfile
FROM ubuntu:latest
ENV PYTHON_SCRIPTNAME=$PYTHON_SCRIPTNAME
RUN apt-get -y update
RUN apt-get install -y wine-stable wget
RUN wget -O python-installer.exe https://www.python.org/ftp/python/3.11.1/python-3.11.1-amd64.exe
RUN wine python-installer.exe /quiet InstallAllUsers=1 PrependPath=1 TargetDir=/root/.wine/drive_c/Python
RUN wine /root/.wine/drive_c/Python/python.exe -m pip install --upgrade pip
RUN wine /root/.wine/drive_c/Python/python.exe -m pip install -r requirements.txt
构建过程/错误信息
# docker build -t test_image -f Dockerfile --network=host .
Sending build context to Docker daemon 25.22MB
Step 1/8 : FROM ubuntu:latest
---> 6b7dfa7e8fdb
Step 2/8 : ENV PYTHON_SCRIPTNAME=$PYTHON_SCRIPTNAME
---> Using cache
---> 48a0ef5b97e2
Step 3/8 : RUN apt-get -y update
---> Using cache
---> 7257e5dd1581
Step 4/8 : RUN apt-get install -y wine-stable wget
---> Using cache
---> 4e60a561a548
Step 5/8 : RUN wget -O python-installer.exe https://www.python.org/ftp/python/3.11.1/python-3.11.1-amd64.exe
---> Using cache
---> 6df012acc310
Step 6/8 : RUN wine start python-installer.exe /quiet InstallAllUsers=1 PrependPath=1 TargetDir=/root/.wine/drive_c/Python
---> Running in aa3b7a55e550
it looks like wine32 is missing, you should install it.
multiarch needs to be enabled first. as root, please
execute "dpkg --add-architecture i386 && apt-get update &&
apt-get install wine32"
wine: created the configuration directory '/root/.wine'
0048:err:explorer:initialize_display_settings Failed to query current display settings for L"\\\\.\\DISPLAY1".
0048:err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hr 0x80004002
0048:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, hr 0x80004002
0048:err:ole:apartment_get_local_server_stream Failed: 0x80004002
002c:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
002c:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
0050:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0050:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
0050:err:ole:apartment_createwindowifneeded CreateWindow failed with error 0
0050:err:ole:apartment_createwindowifneeded CreateWindow failed with error 0
0050:err:ole:apartment_createwindowifneeded CreateWindow failed with error 14007
0050:err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hr 0x800736b7
0050:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, hr 0x800736b7
0050:err:ole:apartment_get_local_server_stream Failed: 0x800736b7
0050:err:ole:start_rpcss Failed to open RpcSs service
0040:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0040:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
0040:err:setupapi:SetupDefaultQueueCallbackW copy error 1812 L"@wineusb.sys,-1" -> L"C:\\windows\\inf\\wineusb.inf"
Could not find Wine Gecko. HTML rendering will be disabled.
it looks like wine32 is missing, you should install it.
multiarch needs to be enabled first. as root, please
execute "dpkg --add-architecture i386 && apt-get update &&
apt-get install wine32"
0098:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0098:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
Could not find Wine Gecko. HTML rendering will be disabled.
wine: configuration in L"/root/.wine" has been updated.
it looks like wine32 is missing, you should install it.
multiarch needs to be enabled first. as root, please
execute "dpkg --add-architecture i386 && apt-get update &&
apt-get install wine32"
00dc:err:process:exec_process L"Z:\\python-installer.exe" not supported on this system
Application could not be started, or no application associated with the specified file.
ShellExecuteEx failed: Bad EXE format for Z:\python-installer.exe.
The command '/bin/sh -c wine start python-installer.exe /quiet InstallAllUsers=1 PrependPath=1 TargetDir=/root/.wine/drive_c/Python' returned a non-zero code: 1