Docker 安装 Poetry 失败

Installing Poetry fails on Docker

我有一个 Django 项目,我正在尝试使用 Docker 对其进行设置。我用的是Poetry,所以我要在容器里安装Poetry。下面是我的 Dockerfile.

FROM python:3.9.7-alpine
WORKDIR /usr/src/app

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# install curl because it does not exist on alpine
RUN apk --no-cache add curl

# install poetry
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -

# install dependencies
RUN poetry install

COPY . .

然而,它给出了这个毫无帮助的晦涩错误:

Traceback (most recent call last):
  File "<stdin>", line 440, in run
  File "<stdin>", line 464, in install
  File "<stdin>", line 589, in install_poetry
  File "/usr/local/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/root/.local/share/pypoetry/venv/bin/python', '-m', 'pip', 'install', 'poetry==1.1.8']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 837, in <module>
  File "<stdin>", line 833, in main
  File "<stdin>", line 443, in run
AttributeError: 'NoneType' object has no attribute 'decode'
The command '/bin/sh -c curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -' returned a non-zero code: 1

没有发现任何与此相关的问题或帖子,所以我想问问是否有人遇到过这个问题有人知道如何解决这个问题。

提前致谢。

不幸的是,安装程序脚本隐藏了原始错误消息。否则可以看到,由于缺少 compiler.Install docs 中列出的包,无法构建加密包 (gcc musl-dev python3-dev libffi-dev openssl-dev货物),它应该可以工作。