Levaya Pochta
Levaya Pochta

Reputation: 199

Error while building python docker container with uWSGI

Here is my 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"]

When building uwsgi wheel got and error:

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>
        |          ^~~~~~~~~~~~~~~~

What package am i need to add to Dockerfile?+

Upvotes: 0

Views: 1335

Answers (2)

I also ran in the situation that the container was not building the uwsgi. After changing "FROM python:3.8-alpine" to "FROM python:3.8" everything worked fine. Then i think you also don't need to install the linux-packages.

Upvotes: 0

Ron Serruya
Ron Serruya

Reputation: 4446

Try adding apk add linux-headers, looks like uwsgi is missing some headers during the build, might be due to alpine being very bare-bones

Upvotes: 1

Related Questions