使用 uWSGI 构建 python docker 容器时出错

时间:2021-01-17 13:27:31

标签: python docker uwsgi wsgi

这是我的 Dockerfile:

FROM python:3.7-alpine


RUN mkdir -p /usr/src/app 
WORKDIR /usr/src/app

COPY . /usr/src/app

RUN apk --update add gcc build-base freetype-dev libpng-dev openblas-dev musl-dev
RUN apk update

RUN pip install --no-cache-dir -r requirements.txt

EXPOSE 5000

CMD ["uwsgi", "app.ini"]

在构建 uwsgi 轮子时出现错误:

In file included from core/utils.c:1:
  ./uwsgi.h:238:10: fatal error: linux/limits.h: No such file or directory
    238 | #include <linux/limits.h>
        |          ^~~~~~~~~~~~~~~~

我需要将什么包添加到 Dockerfile?+

1 个答案:

答案 0 :(得分:0)

尝试添加 apk add linux-headers,看起来 uwsgi 在构建过程中缺少一些标头,可能是由于 alpine 非常简单